package attend.dao.attend;

import org.apache.log4j.Logger;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import attend.com.CodeMetrix;

import exception.BaseException;

import util.DBConnection;

/**
 * 근태확인 -관리자-
 * @author Yang Chang Hwan
 * @since	2009/02/02
 */
public class AttendManagerDao extends DBConnection {
	/**
	 * Logger for this class
	 */
	private static final Logger logger = Logger.getLogger(AttendManagerDao.class);
	
	private Connection 			con			=			null;
	
	private PreparedStatement 	pstmt		=			null;
	
	private ResultSet			rs			=			null;
	
	private StringBuffer		sql			=	new StringBuffer();
	
	private List<HashMap<String, String>> 	list;
	
	private List<HashMap<String, String>> 	list_0001	;	//정상출근	0001
	private List<HashMap<String, String>> 	list_0002	;	//지각		0002
	private List<HashMap<String, String>> 	list_0003	;	//현지출근	0003
	private List<HashMap<String, String>> 	list_0005	;	//오전공가	0005
	private List<HashMap<String, String>> 	list_0004	;	//오전공가	0004
	private List<HashMap<String, String>> 	list_0007	;
	private List<HashMap<String, String>> 	list_0008	;
	private List<HashMap<String, String>> 	list_0009	;
	private List<HashMap<String, String>> 	list_XX		;	//미입력		XX
	private List<HashMap<String, String>> 	list_NN		;	//결근		NN
	private List<HashMap<String, String>> 	list_2001	;	//연차휴가	2001
	private List<HashMap<String, String>> 	list_2002	;	//특별휴가	2002
	private List<HashMap<String, String>> 	list_2003	;	//경조휴가	2003
	private List<HashMap<String, String>> 	list_2004	;	//공가		2004
	
	private HashMap<String, String>			hmCondition;

	private Integer 						rowCount;
	private Integer 						p_count;	//한페이지당 결과수

	private String 							msg;

	private List<HashMap<String, String>> list_LL;

	private List<HashMap<String, String>> list_2005;
	

	public AttendManagerDao() {}


	/**
	 * <pre>
	 * 출퇴근확인 Paging처리를 위해
	 * Row Count를 구한다.
	 * 조건들을 inline 하게 된다.
	 * </pre>
	 * @throws BaseException
	 * @throws SQLException
	 */
	public void retrieveAttendDetailRowCount(HashMap<String, String> hmCondition , int emp_no) throws BaseException , SQLException {
		
		logger.info(hmCondition);
		
		con = getDataSource().getConnection();
		
		try {
			
			sql	=	new StringBuffer();
			
			sql.setLength(0);
			
			sql.append("\r\n").append("			SELECT COUNT(*)	ROWCNT																																				");
			sql.append("\r\n").append("			FROM																																								");
			sql.append("\r\n").append("			(																																									");
			sql.append("\r\n").append("				SELECT  ROW_NUMBER() OVER( ORDER BY XX.YYYYMMDD DESC , XX.EMP_NO , XX.IN_OUT_TP , XX.GROUP_NO , XX.TEAM_NO ) ROWNUM,											");
			sql.append("\r\n").append("						XX.GROUP_NO				,																																");
			sql.append("\r\n").append("						CASE WHEN CHARINDEX('(' ,XX.GROUP_NM	) = 0 THEN XX.GROUP_NM ELSE SUBSTRING(XX.GROUP_NM , 1 , (CHARINDEX('(' ,XX.GROUP_NM	) - 1))	 END AS GROUP_NM			,		");
			sql.append("\r\n").append("						XX.GROUP_NM 	AS  GROUP_NM_TT			,																												");
			sql.append("\r\n").append("						XX.TEAM_NO				,																																");
			sql.append("\r\n").append("						XX.TEAM_NM				,																																");
			sql.append("\r\n").append("						XX.EMP_NO				,																																");
			sql.append("\r\n").append("						XX.EMP_NM				,																																");
			sql.append("\r\n").append("						XX.IN_OUT_DETAIL		,																																");
			sql.append("\r\n").append("						XX.IN_OUT_DETAIL_NM		,																																");
			sql.append("\r\n").append("						XX.IN_DETAIL			,																																");
			sql.append("\r\n").append("						XX.YYYYMMDD				,																																");
			sql.append("\r\n").append("						SUBSTRING(DATENAME(DW , CONVERT(SMALLDATETIME , XX.YYYYMMDD) ) ,1 ,1) AS  DAYNAME ,																		");
			sql.append("\r\n").append("						XX.IN_OUT_TP			,																																");
			sql.append("\r\n").append("						CASE WHEN XX.IN_OUT_TP = 'I' THEN  '출' ELSE '퇴' END IN_OUT_TP_NM 		,																				");
			sql.append("\r\n").append("						XX.IN_OUT_DT			,																																");
			sql.append("\r\n").append("						SUBSTRING(XX.IN_OUT_TIME,1,2) + ':' + SUBSTRING(XX.IN_OUT_TIME,3,4)	AS IN_OUT_TIME		,																");
			sql.append("\r\n").append("						XX.IN_OUT_PLACE			,																																");
			sql.append("\r\n").append("						C.CD_NM AS IN_OUT_PLACE_NM ,																															");
			sql.append("\r\n").append("						XX.ETC_EMP				,																																");
			sql.append("\r\n").append("						SUBSTRING(XX.ETC_EMP , 1 , 10) AS ETC_EMP_MEMO 	, 																										");
			sql.append("\r\n").append("						XX.ETC_MGR				,																																");
			sql.append("\r\n").append("						XX.REG_IP				,																																");
			sql.append("\r\n").append("						XX.MGR_CHANGE_YN		,																																");
			sql.append("\r\n").append("						XX.UPDATE_DT			,																																");
			sql.append("\r\n").append("						XX.APPROV_EMP_NO		,																																");
			sql.append("\r\n").append("						SUBSTRING(E.EMP_NM , 1, 3)	AS APPROV_EMP_NM		,																									");
			sql.append("\r\n").append("						E.EMP_NM 	AS APPROV_EMP_NM_TT		                ,																									");
			sql.append("\r\n").append("						XX.CONFIRM_YN			,																																");
			sql.append("\r\n").append("						XX.ADVANTAGE			,																																");
			sql.append("\r\n").append("						A_CD.ETC AS ADVANTAGE_NM,																																");
			sql.append("\r\n").append("						CASE WHEN (F.CLOSE_DT is null ) THEN 'N' ELSE 'Y' END  CLOSE_DT																							");
			sql.append("\r\n").append("				FROM																																							");
			sql.append("\r\n").append("				(																																								");
			sql.append("\r\n").append("						SELECT 																																					");
			sql.append("\r\n").append("								--ROW_NUMBER() OVER( ORDER BY IO.YYYYMMDD DESC , IO.EMP_NO , IO.IN_OUT_TP , VD.GROUP_NO , VD.TEAM_NO ) ROWNUM,									");
			sql.append("\r\n").append("								VD.GROUP_NO		,	VD.GROUP_NM,																												");
			sql.append("\r\n").append("								VD.TEAM_NO		,	VD.TEAM_NM,																													");
			sql.append("\r\n").append("								IO.EMP_NO		,	VD.EMP_NM,																													");
			sql.append("\r\n").append("								IO.IN_OUT_DETAIL,	IO.IN_OUT_DETAIL_NM,																										");
			sql.append("\r\n").append("								IO.IN_DETAIL	,																																");
			sql.append("\r\n").append("								IO.YYYYMMDD		,		IO.IN_OUT_TP,				--PK ROW																					");
			sql.append("\r\n").append("																																												");
			sql.append("\r\n").append("								IO.IN_OUT_DT,																																	");
			sql.append("\r\n").append("								IO.IN_OUT_TIME,																																	");
			sql.append("\r\n").append("																																												");
			sql.append("\r\n").append("								IO.IN_OUT_PLACE,																																");
			sql.append("\r\n").append("								IO.IN_OUT_PLACE_NM,																																");
			sql.append("\r\n").append("																																												");
			sql.append("\r\n").append("								IO.ETC_EMP,																																		");
			sql.append("\r\n").append("								IO.ETC_MGR,																																		");
			sql.append("\r\n").append("																																												");
			sql.append("\r\n").append("								IO.REG_IP,																																		");
			sql.append("\r\n").append("																																												");
			sql.append("\r\n").append("								IO.MGR_CHANGE_YN,																																");
			sql.append("\r\n").append("																																												");
			sql.append("\r\n").append("								IO.UPDATE_DT,																																	");
			sql.append("\r\n").append("								IO.APPROV_EMP_NO,																																");
			sql.append("\r\n").append("								IO.CONFIRM_YN,																																	");
			sql.append("\r\n").append("								IO.ADVANTAGE																																	");
			sql.append("\r\n").append("						FROM																																					");
			sql.append("\r\n").append("							(																																					");
			sql.append("\r\n").append("								SELECT  IO_CD.IN_OUT_DETAIL_NM ,																												");
			sql.append("\r\n").append("												IO_IN.*																															");
			sql.append("\r\n").append("								FROM 																																			");
			sql.append("\r\n").append("									(																																			");
			sql.append("\r\n").append("										--출퇴근유형																																");
			sql.append("\r\n").append("										SELECT A.YYYYMMDD , A.IN_OUT_TP , A.EMP_NO , A.IN_OUT_DETAIL, C.GROUP_CD, C.CD_NM AS IN_OUT_DETAIL_NM, C.ETC							");
			sql.append("\r\n").append("											FROM TB_ATTEND A, ( SELECT * FROM TB_COMM_CD WHERE ETC_CD IS NULL AND CD != '0' AND USE_YN = 'Y' ) C								");
			sql.append("\r\n").append("										WHERE A.IN_OUT_DETAIL = C.CD																											");
			sql.append("\r\n").append("									) IO_CD , 																																	");
			sql.append("\r\n").append("									(																																			");
			sql.append("\r\n").append("										--퇴근 ROW에 출근유형 추가																													");
			sql.append("\r\n").append("										SELECT 																																	");
			sql.append("\r\n").append("												AI.IN_OUT_DETAIL AS IN_DETAIL , A.*																								");
			sql.append("\r\n").append("										FROM 																																	");
			sql.append("\r\n").append("												TB_ATTEND A , 																													");
			sql.append("\r\n").append("												(SELECT YYYYMMDD , EMP_NO , IN_OUT_TP , IN_OUT_DETAIL  FROM TB_ATTEND WHERE IN_OUT_TP = 'I') AI									");
			sql.append("\r\n").append("										WHERE	--근태날짜와 사번만 조인																												");
			sql.append("\r\n").append("												A.YYYYMMDD = AI.YYYYMMDD 	--근태날짜																							");
			sql.append("\r\n").append("												AND 																																				");		
			sql.append("\r\n").append("												A.EMP_NO = AI.EMP_NO			--사번																												");
			sql.append("\r\n").append("												AND     A.YYYYMMDD   BETWEEN    REPLACE('"+hmCondition.get("s_date")+"' , '-' , '')  AND    REPLACE('"+hmCondition.get("e_date")+"' , '-' , '')		");
			sql.append("\r\n").append("									) IO_IN																																							");
			sql.append("\r\n").append("								WHERE	IO_CD.YYYYMMDD = IO_IN.YYYYMMDD																																");
			sql.append("\r\n").append("										AND																																							");
			sql.append("\r\n").append("										IO_CD.EMP_NO = IO_IN.EMP_NO																																	");
			sql.append("\r\n").append("										AND 																																						");
			sql.append("\r\n").append("										IO_CD.IN_OUT_TP = IO_IN.IN_OUT_TP																															");
			sql.append("\r\n").append("							) IO ,																																									");
			sql.append("\r\n").append("							V_DEPT	VD																																								");
			sql.append("\r\n").append("							WHERE IO.EMP_NO = VD.EMP_NO	AND 	VD.EMP_NO = 	"+emp_no+"																											");
			sql.append("\r\n").append("					) XX LEFT OUTER JOIN TB_COMM_CD 	C 		ON 	XX.IN_OUT_PLACE 	= 	C.CD 			--출퇴근지명칭 																			");
			sql.append("\r\n").append("					LEFT JOIN TB_COMM_CD 				A_CD 	ON 	XX.ADVANTAGE 		= 	A_CD.CD			--휴가반영 																				");
			sql.append("\r\n").append("					LEFT JOIN TB_EMP 					E 		ON 	XX.APPROV_EMP_NO 	= 	E.EMP_NO		--확인자 																					");
			sql.append("\r\n").append("					LEFT JOIN TB_ATTEND_CLOSE 			F 		ON  XX.YYYYMMDD 		=	F.CLOSE_DT		--마감여부 																				");
			sql.append("\r\n").append("					     --JOIN TB_AUTH_DEPT 				AZ 		ON 	XX.TEAM_NO 			= 	AZ.DEPT_NO 	 	AND 	AZ.EMP_NO =	"+emp_no+" 															");
			
			sql.append("\r\n").append("					/*출근유형 AND 퇴근유형 START*/																																						");
			sql.append("\r\n").append("						 JOIN TB_ATTEND				IA		ON  XX.YYYYMMDD			=	IA.YYYYMMDD	AND XX.EMP_NO = IA.EMP_NO	AND IA.IN_OUT_TP = 'I'	");
			
			//결근이 선택되지 않았을 경우
			if (!hmCondition.get("absence_type").equals(CodeMetrix.NN) ) {
				//출근상세
				if (!hmCondition.get("chk_in_type").equals(CodeMetrix.ALL)) {
					sql.append("\r\n").append("						 AND IA.IN_OUT_DETAIL = '"+hmCondition.get("chk_in_type")+"'				");
				}
			}
			
			sql.append("\r\n").append("						 JOIN TB_ATTEND				OA		ON  XX.YYYYMMDD			=   OA.YYYYMMDD AND XX.EMP_NO = OA.EMP_NO	AND OA.IN_OUT_TP = 'O'	");
			
			//결근이 선택되지 않았을 경우
			if (!hmCondition.get("absence_type").equals(CodeMetrix.NN) ) {
				if (!hmCondition.get("chk_out_type").equals(CodeMetrix.ALL)) {
					sql.append("\r\n").append("						 AND OA.IN_OUT_DETAIL = '"+hmCondition.get("chk_out_type")+"'			");
				}
			}
			
			sql.append("\r\n").append("					/*출근유형 AND 퇴근유형 END*/																																						");
			sql.append("\r\n").append("																																																	");
			sql.append("\r\n").append("				WHERE 1	=	1																																										");
			sql.append("\r\n").append("					  /*조회조건 START*/																																								");
			sql.append("\r\n").append("					  --AND	GROUP_NO 	LIKE	REPLACE('"+hmCondition.get("sgroup")+"' , 'ALL' , '%')		--	그룹																					");
			sql.append("\r\n").append("					  --AND 	TEAM_NO		LIKE	REPLACE('"+hmCondition.get("steam")+"' , 'ALL' , '%')		--	팀																						");
			//sql.append("\r\n").append("					  AND 	XX.EMP_NO	LIKE	REPLACE('"+hmCondition.get("semp_no")+"' , 'ALL' , '%')																								");
			
			/**특근조회 S T A R T**/
			if (hmCondition.get("sp_work_type").equals("SWO")) {
				
				if (hmCondition.get("sp_work_gubun").equals(CodeMetrix.ALL)) {
					
					sql.append("\r\n").append("					  AND (	IA.IN_OUT_DETAIL IN	(	'0006'	) 																");
					sql.append("\r\n").append("					  OR 	OA.IN_OUT_DETAIL IN	(	'1005'	,	'1008' 	) 		)											");
				} else if (hmCondition.get("sp_work_gubun").equals("1005")) {	//철야
					sql.append("\r\n").append("					  AND 	OA.IN_OUT_DETAIL =		'"+hmCondition.get("sp_work_gubun")+"' 					 				");
				} else if (hmCondition.get("sp_work_gubun").equals("0006")) {	//
					sql.append("\r\n").append("					  AND 	IA.IN_OUT_DETAIL =		'"+hmCondition.get("sp_work_gubun")+"' 					 				");
				}
				
			} else if (hmCondition.get("sp_work_type").equals("SWX")) {
				sql.append("\r\n").append("					  AND (	IA.IN_OUT_DETAIL !=	'0006'	 																");
				sql.append("\r\n").append("					  AND 	OA.IN_OUT_DETAIL NOT	IN	(	'1005' ,	'1008' 	) 		)											");
			}
			/**특근조회 E   N   D**/
			
			//추가 휴가반영 검색조건
			if (hmCondition.get("addVacation").equals("AVO")) {
				if (hmCondition.get("addVacation_gubun").equals(CodeMetrix.ALL)) {
					sql.append("\r\n").append("						AND     OA.ADVANTAGE             IN   ( '3302' , '3303' )		--반일 + 일일휴가																			");
				} else {
					sql.append("\r\n").append("						AND     OA.ADVANTAGE             =   '"+hmCondition.get("addVacation_gubun")+"'						");
				}
			} else	if (hmCondition.get("addVacation").equals("AVX")) {
				sql.append("\r\n").append("						AND    ( OA.ADVANTAGE             =    '3301' OR LEN(OA.ADVANTAGE) = 0 OR OA.ADVANTAGE = '' )		--반일 + 일일휴가											");
			}	
			
			//사번이 ALL인 경우에 쿼리에서 제외한다.
			if (!hmCondition.get("semp_no").equals(CodeMetrix.ALL) &&  hmCondition.get("searchEmpNm").equals("")) {
				sql.append("\r\n").append("					  --AND     XX.EMP_NO                    =   '"+hmCondition.get("semp_no")+"'                    																				");
			} else
				
				//사원검색일 경우 추가됨
				if ( (hmCondition.get("semp_no").equals(CodeMetrix.ALL) || hmCondition.get("semp_no").equals("")) &&  !hmCondition.get("searchEmpNm").equals("")) {
					sql.append("\r\n").append("					  --AND     XX.EMP_NM                    LIKE    '"+hmCondition.get("searchEmpNm")+"%'                   																		");
				}
			
			//확인여부가 ALL인경우 쿼리에서 제외시킴
			if (!hmCondition.get("confirm_yn").equals(CodeMetrix.ALL)) {
				sql.append("\r\n").append("					  AND     XX.CONFIRM_YN                =   '"+hmCondition.get("confirm_yn")+"' --확인여부																						");
			}
			
			//관리자 변경 여부가 ALL이 아닌경우 쿼리에서 제외시킴
			if (!hmCondition.get("mgr_change_yn").equals(CodeMetrix.ALL)) {
				sql.append("\r\n").append("					  AND     XX.MGR_CHANGE_YN             =   '" + hmCondition.get("mgr_change_yn") + "'  --CASE ? WHEN 'ALL' THEN '%' ELSE THEN ? END											");
			}
			
			
			sql.append("\r\n").append("					  AND   XX.IN_OUT_TP LIKE  	REPLACE('" + hmCondition.get("in_out_tp_condi") + "' , 'ALL' , '%')			--출퇴근분류 																");
			
			//결근
			if (hmCondition.get("absence_type").equals(CodeMetrix.NN) ) {
//		    	sql.append("\r\n").append("				AND	  XX.IN_OUT_DETAIL = '"+hmCondition.get("absence_type")+"'   --결근																											");
				sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL LIKE	REPLACE('"+hmCondition.get("absence_type")+"' , 'ALL' , '%')	--출퇴근유형상세 																");
			}
			
			/**휴가조회 START**/
			if(hmCondition.get("vacation_yn").equals("VCO")) {     //휴가여부가 휴가이면,,
							
				if (hmCondition.get("vacation_type").equals(CodeMetrix.ALL)) {  //모든 휴가
					sql.append("\r\n").append("	 AND 	XX.IN_OUT_DETAIL IN ( '0004' , '0005' , '0007' , '0008' , '0009' , '1006' , '1007' , '1009' , '1010' , '1011' , '2001' , '2002' , '2003' , '2004' , '2005'  ) 	");
					
				}else if (hmCondition.get("vacation_type").equals("VSO")) {		//연차관련
					
					if (hmCondition.get("vacation_gubun").equals(CodeMetrix.ALL)) { //모든 연차관련휴가(연차 + 특별)
						sql.append("\r\n").append("					  AND XX.IN_OUT_DETAIL  IN ( '0004' , '1006' , '2001' , '0007' , '1009' , '2002'  )	");
						
					} else if (hmCondition.get("vacation_gubun").equals("2001")) {	//연차						
						if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 연차휴가						
							sql.append("\r\n").append("			 AND 	XX.IN_OUT_DETAIL IN ( '0004' , '1006' , '2001' ) 	 ");
						}else if(hmCondition.get("vacation_detail").equals("HDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
							sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0004' AND OA.IN_OUT_DETAIL = '1006') OR (IA.IN_OUT_DETAIL = '2001' AND OA.IN_OUT_DETAIL = '2001')  ");
						}else if(hmCondition.get("vacation_detail").equals("HHD")) {   //반일휴가 
							if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
								sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0004' AND OA.IN_OUT_DETAIL != '1006' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0004' AND OA.IN_OUT_DETAIL = '1006' AND XX.IN_OUT_TP = 'O'))	");
							}else if(hmCondition.get("h_vacation_type").equals("0004")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0004'	AND OA.IN_OUT_DETAIL != '1006' AND XX.IN_OUT_TP = 'I' ");					
							}else if(hmCondition.get("h_vacation_type").equals("1006")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0004'	AND OA.IN_OUT_DETAIL = '1006' AND XX.IN_OUT_TP = 'O' ");								
							}
						}
						//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");

					} else if (hmCondition.get("vacation_gubun").equals("2002")) {	//특별
						if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 특별휴가						
							sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0007' , '1009' , '2002' ) 	 				");
						}else if(hmCondition.get("vacation_detail").equals("SDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
							sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0007' AND OA.IN_OUT_DETAIL = '1009') OR (IA.IN_OUT_DETAIL = '2002' AND OA.IN_OUT_DETAIL = '2002')  ");
						}else if(hmCondition.get("vacation_detail").equals("SHD")) {   //반일휴가 
							if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
								sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0007' AND OA.IN_OUT_DETAIL != '1009' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0007' AND OA.IN_OUT_DETAIL = '1009' AND XX.IN_OUT_TP = 'O'))	");
							}else if(hmCondition.get("h_vacation_type").equals("0004")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0007'	AND OA.IN_OUT_DETAIL != '1009' AND XX.IN_OUT_TP = 'I' ");				
							}else if(hmCondition.get("h_vacation_type").equals("1006")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0007'	AND OA.IN_OUT_DETAIL = '1009' AND XX.IN_OUT_TP = 'O' ");								
							}
						}
						//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
						
					} //else if (hmCondition.get("vacation_gubun").equals("HFV")) {	//반일연차
						//if (hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
						//	sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN		( '0004' , '1006' ) 	--// 													");
							
						//} else if (hmCondition.get("h_vacation_type").equals("0004")) {
						//	sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL =		'"+hmCondition.get("h_vacation_type")+"'  	--// 				");
						//} else if (hmCondition.get("h_vacation_type").equals("1006")) {
						//	sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL =		 '"+hmCondition.get("h_vacation_type")+"'  	--// 				");
						//}
						
					//}
				}else if (hmCondition.get("vacation_type").equals("VSX")) {		//연차외
					
					//if (hmCondition.get("vacation_gubun").equals("HFO")) {	//반일공가
						
					//	if (hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
					//		sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN		( '0005' , '1007' ) 	--// 									");
					//	} else {
					//		sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL =		'"+hmCondition.get("h_vacation_type")+"'  	--// 				");
					//	}
					//} 
					//else 
					if (hmCondition.get("vacation_gubun").equals(CodeMetrix.ALL)) {	// 모든 연차외 휴가(경조+공가+기타)
						sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0005' , '1007' , '2004' , '0008' , '1010' , '2003' , '0009' , '1011' , '2005'  )   			");
						//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
					} else if (hmCondition.get("vacation_gubun").equals("2003")) {	//경조
						if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 경조휴가						
							sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0008' , '1010' , '2003' ) 	 				");
						}else if(hmCondition.get("vacation_detail").equals("FDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
							sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0008' AND OA.IN_OUT_DETAIL = '1010') OR (IA.IN_OUT_DETAIL = '2003' AND OA.IN_OUT_DETAIL = '2003')  ");
						}else if(hmCondition.get("vacation_detail").equals("FHD")) {   //반일휴가 
							if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
								sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0008' AND OA.IN_OUT_DETAIL != '1010' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0008' AND OA.IN_OUT_DETAIL = '1010' AND XX.IN_OUT_TP = 'O'))	");
							}else if(hmCondition.get("h_vacation_type").equals("0004")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0008'	AND OA.IN_OUT_DETAIL != '1010' AND XX.IN_OUT_TP = 'I' ");				
							}else if(hmCondition.get("h_vacation_type").equals("1006")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0008'	AND OA.IN_OUT_DETAIL = '1010' AND XX.IN_OUT_TP = 'O' ");						
							}
						}
						
					
						//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
					} else if (hmCondition.get("vacation_gubun").equals("2004")) {	//공가
						if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 공가					
							sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0005' , '1007' , '2004' ) 	 				");
						}else if(hmCondition.get("vacation_detail").equals("GDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
							sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0005' AND OA.IN_OUT_DETAIL = '1007') OR (IA.IN_OUT_DETAIL = '2004' AND OA.IN_OUT_DETAIL = '2004')  ");
						}else if(hmCondition.get("vacation_detail").equals("GHD")) {   //반일휴가 
							if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
								sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0005' AND OA.IN_OUT_DETAIL != '1007' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0005' AND OA.IN_OUT_DETAIL = '1007' AND XX.IN_OUT_TP = 'O'))	");
							}else if(hmCondition.get("h_vacation_type").equals("0004")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0005'	AND OA.IN_OUT_DETAIL != '1007' AND XX.IN_OUT_TP = 'I' ");				
							}else if(hmCondition.get("h_vacation_type").equals("1006")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0005'	AND OA.IN_OUT_DETAIL = '1007' AND XX.IN_OUT_TP = 'O' ");	
							}							
						}
					
						//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
					} else if (hmCondition.get("vacation_gubun").equals("2005")) {	//기타
						if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 기타휴가						
							sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0009' , '1011' , '2005' ) 	 				");
						}else if(hmCondition.get("vacation_detail").equals("EDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
							sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0009' AND OA.IN_OUT_DETAIL = '1011') OR (IA.IN_OUT_DETAIL = '2005' AND OA.IN_OUT_DETAIL = '2005')  ");
						}else if(hmCondition.get("vacation_detail").equals("EHD")) {   //반일휴가 
							if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
								sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0009' AND OA.IN_OUT_DETAIL != '1011' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0009' AND OA.IN_OUT_DETAIL = '1011' AND XX.IN_OUT_TP = 'O'))	");
							}else if(hmCondition.get("h_vacation_type").equals("0004")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0009'	AND OA.IN_OUT_DETAIL != '1011' AND XX.IN_OUT_TP = 'I' ");					
							}else if(hmCondition.get("h_vacation_type").equals("1006")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0009'	AND OA.IN_OUT_DETAIL = '1011' AND XX.IN_OUT_TP = 'O' ");
							}							
						}
					}
						
						//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
				} else {
						//sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN		('0005' , '1007' , '2003' , '2004' , '2005'  )	--// 				");
						sql.append("\r\n").append("					  AND (XX.IN_OUT_DETAIL  IN ( '0005' , '1007' ) OR XX.IN_OUT_DETAIL IN ( '2003' , '2004' , '2005'  ) AND XX.IN_OUT_TP = 'O')		");
					}
					
			}

			if(hmCondition.get("vacation_yn").equals("VCX")) {     //휴가여부가 미휴가이면,,
				sql.append("\r\n").append("		AND 	XX.IN_OUT_DETAIL IN		( '0001' , '0002' , '0003'  , '0006' , '1001' , '1002' , '1003' , '1004' , '1005' , '1008' )   ");
			}
			
			/**휴가조회 END**/			//휴가유형
			//else if (!hmCondition.get("vacation_type").equals(CodeMetrix.ALL)) {
			//	sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL LIKE	REPLACE('"+hmCondition.get("vacation_type")+"' , 'ALL' , '%')	--출퇴근유형상세 														");
			//}
			
			sql.append("\r\n").append("					  /*조회조건 END*/																																						");
			sql.append("\r\n").append("					  																																										");
			sql.append("\r\n").append("			) Z																																												");
			
	        System.out.println("======================================11111\r\n");
			System.out.println("--근태관리-관리자-근태확인 ROW COUNT11111\r\n" + sql.toString());
			System.out.println("======================================11111\r\n");
			
			logger.info("\n" + sql);
			
			pstmt 	= con.prepareStatement(sql.toString());
			
			/**************************************************************************/
			//P A R A M E T E R		V A L U E S		S T A R T
			/**************************************************************************/
			/**************************************************************************/
			//P A R A M E T E R		V A L U E S		E   N   D
			/**************************************************************************/
			
			rs		= pstmt.executeQuery();
			
			if (rs.next()) {
				rowCount	=	Integer.valueOf(rs.getString("ROWCNT"));		//조건조회 결과
			}
			
		} catch (SQLException se) {
			se.printStackTrace();
			BaseException dex = new BaseException();                
			dex.setException(se);
			dex.setAppReturnCode("10");
			throw dex;
		} catch(Exception e) {
			BaseException dex = new BaseException();                
			dex.setException(e);
			dex.setAppReturnCode("20");
			throw dex;
		} finally {
			try {
				if (pstmt != null) pstmt.close();
				if (rs != null) rs.close();
				if(con != null) con.close();
				
			} catch(SQLException fse) {
				BaseException dex = new BaseException();                
				dex.setException(fse);
				dex.setAppReturnCode("10");
				throw dex;
			}
		}
	}
	
//public void retrieveReqManagerRowCount(HashMap<String, String> hmCondition , int emp_no) throws BaseException , SQLException {
//		
//		logger.info(hmCondition);
//		
//		con = getDataSource().getConnection();
//		
//		try {
//			
//			sql	=	new StringBuffer();
//			
//			sql.setLength(0);
//			
//			sql.append("\r\n").append("			SELECT COUNT(*)	ROWCNT																																				");
//			sql.append("\r\n").append("			FROM																																								");
//			sql.append("\r\n").append("			(																																									");
//			sql.append("\r\n").append("				SELECT  ROW_NUMBER() OVER( ORDER BY XX.YYYYMMDD DESC , XX.EMP_NO , XX.IN_OUT_TP , XX.GROUP_NO , XX.TEAM_NO ) ROWNUM,											");
//			sql.append("\r\n").append("						XX.GROUP_NO				,																																");
//			sql.append("\r\n").append("						CASE WHEN CHARINDEX('(' ,XX.GROUP_NM	) = 0 THEN XX.GROUP_NM ELSE SUBSTRING(XX.GROUP_NM , 1 , (CHARINDEX('(' ,XX.GROUP_NM	) - 1))	 END AS GROUP_NM			,		");
//			sql.append("\r\n").append("						XX.GROUP_NM 	AS  GROUP_NM_TT			,																												");
//			sql.append("\r\n").append("						XX.TEAM_NO				,																																");
//			sql.append("\r\n").append("						XX.TEAM_NM				,																																");
//			sql.append("\r\n").append("						XX.EMP_NO				,																																");
//			sql.append("\r\n").append("						XX.EMP_NM				,																																");
//			sql.append("\r\n").append("						XX.IN_OUT_DETAIL		,																																");
//			sql.append("\r\n").append("						XX.IN_OUT_DETAIL_NM		,																																");
//			sql.append("\r\n").append("						XX.IN_DETAIL			,																																");
//			sql.append("\r\n").append("						XX.YYYYMMDD				,																																");
//			sql.append("\r\n").append("						SUBSTRING(DATENAME(DW , CONVERT(SMALLDATETIME , XX.YYYYMMDD) ) ,1 ,1) AS  DAYNAME ,																		");
//			sql.append("\r\n").append("						XX.IN_OUT_TP			,																																");
//			sql.append("\r\n").append("						CASE WHEN XX.IN_OUT_TP = 'I' THEN  '출' ELSE '퇴' END IN_OUT_TP_NM 		,																				");
//			sql.append("\r\n").append("						XX.IN_OUT_DT			,																																");
//			sql.append("\r\n").append("						SUBSTRING(XX.IN_OUT_TIME,1,2) + ':' + SUBSTRING(XX.IN_OUT_TIME,3,4)	AS IN_OUT_TIME		,																");
//			sql.append("\r\n").append("						XX.IN_OUT_PLACE			,																																");
//			sql.append("\r\n").append("						C.CD_NM AS IN_OUT_PLACE_NM ,																															");
//			sql.append("\r\n").append("						XX.ETC_EMP				,																																");
//			sql.append("\r\n").append("						SUBSTRING(XX.ETC_EMP , 1 , 10) AS ETC_EMP_MEMO 	, 																										");
//			sql.append("\r\n").append("						XX.ETC_MGR				,																																");
//			sql.append("\r\n").append("						XX.REG_IP				,																																");
//			sql.append("\r\n").append("						XX.MGR_CHANGE_YN		,																																");
//			sql.append("\r\n").append("						XX.UPDATE_DT			,																																");
//			sql.append("\r\n").append("						XX.APPROV_EMP_NO		,																																");
//			sql.append("\r\n").append("						SUBSTRING(E.EMP_NM , 1, 3)	AS APPROV_EMP_NM		,																									");
//			sql.append("\r\n").append("						E.EMP_NM 	AS APPROV_EMP_NM_TT		                ,																									");
//			sql.append("\r\n").append("						XX.CONFIRM_YN			,																																");
//			sql.append("\r\n").append("						XX.ADVANTAGE			,																																");
//			sql.append("\r\n").append("						A_CD.ETC AS ADVANTAGE_NM,																																");
//			sql.append("\r\n").append("						CASE WHEN (F.CLOSE_DT is null ) THEN 'N' ELSE 'Y' END  CLOSE_DT																							");
//			sql.append("\r\n").append("				FROM																																							");
//			sql.append("\r\n").append("				(																																								");
//			sql.append("\r\n").append("						SELECT 																																					");
//			sql.append("\r\n").append("								--ROW_NUMBER() OVER( ORDER BY IO.YYYYMMDD DESC , IO.EMP_NO , IO.IN_OUT_TP , VD.GROUP_NO , VD.TEAM_NO ) ROWNUM,									");
//			sql.append("\r\n").append("								VD.GROUP_NO		,	VD.GROUP_NM,																												");
//			sql.append("\r\n").append("								VD.TEAM_NO		,	VD.TEAM_NM,																													");
//			sql.append("\r\n").append("								IO.EMP_NO		,	VD.EMP_NM,																													");
//			sql.append("\r\n").append("								IO.IN_OUT_DETAIL,	IO.IN_OUT_DETAIL_NM,																										");
//			sql.append("\r\n").append("								IO.IN_DETAIL	,																																");
//			sql.append("\r\n").append("								IO.YYYYMMDD		,		IO.IN_OUT_TP,				--PK ROW																					");
//			sql.append("\r\n").append("																																												");
//			sql.append("\r\n").append("								IO.IN_OUT_DT,																																	");
//			sql.append("\r\n").append("								IO.IN_OUT_TIME,																																	");
//			sql.append("\r\n").append("																																												");
//			sql.append("\r\n").append("								IO.IN_OUT_PLACE,																																");
//			sql.append("\r\n").append("								IO.IN_OUT_PLACE_NM,																																");
//			sql.append("\r\n").append("																																												");
//			sql.append("\r\n").append("								IO.ETC_EMP,																																		");
//			sql.append("\r\n").append("								IO.ETC_MGR,																																		");
//			sql.append("\r\n").append("																																												");
//			sql.append("\r\n").append("								IO.REG_IP,																																		");
//			sql.append("\r\n").append("																																												");
//			sql.append("\r\n").append("								IO.MGR_CHANGE_YN,																																");
//			sql.append("\r\n").append("																																												");
//			sql.append("\r\n").append("								IO.UPDATE_DT,																																	");
//			sql.append("\r\n").append("								IO.APPROV_EMP_NO,																																");
//			sql.append("\r\n").append("								IO.CONFIRM_YN,																																	");
//			sql.append("\r\n").append("								IO.ADVANTAGE																																	");
//			sql.append("\r\n").append("						FROM																																					");
//			sql.append("\r\n").append("							(																																					");
//			sql.append("\r\n").append("								SELECT  IO_CD.IN_OUT_DETAIL_NM ,																												");
//			sql.append("\r\n").append("												IO_IN.*																															");
//			sql.append("\r\n").append("								FROM 																																			");
//			sql.append("\r\n").append("									(																																			");
//			sql.append("\r\n").append("										--출퇴근유형																																");
//			sql.append("\r\n").append("										SELECT A.YYYYMMDD , A.IN_OUT_TP , A.EMP_NO , A.IN_OUT_DETAIL, C.GROUP_CD, C.CD_NM AS IN_OUT_DETAIL_NM, C.ETC							");
//			sql.append("\r\n").append("											FROM TB_ATTEND A, ( SELECT * FROM TB_COMM_CD WHERE ETC_CD IS NULL AND CD != '0' AND USE_YN = 'Y' ) C								");
//			sql.append("\r\n").append("										WHERE A.IN_OUT_DETAIL = C.CD																											");
//			sql.append("\r\n").append("									) IO_CD , 																																	");
//			sql.append("\r\n").append("									(																																			");
//			sql.append("\r\n").append("										--퇴근 ROW에 출근유형 추가																													");
//			sql.append("\r\n").append("										SELECT 																																	");
//			sql.append("\r\n").append("												AI.IN_OUT_DETAIL AS IN_DETAIL , A.*																								");
//			sql.append("\r\n").append("										FROM 																																	");
//			sql.append("\r\n").append("												TB_ATTEND A , 																													");
//			sql.append("\r\n").append("												(SELECT YYYYMMDD , EMP_NO , IN_OUT_TP , IN_OUT_DETAIL  FROM TB_ATTEND WHERE IN_OUT_TP = 'I') AI									");
//			sql.append("\r\n").append("										WHERE	--근태날짜와 사번만 조인																												");
//			sql.append("\r\n").append("												A.YYYYMMDD = AI.YYYYMMDD 	--근태날짜																							");
//			sql.append("\r\n").append("												AND 																																				");		
//			sql.append("\r\n").append("												A.EMP_NO = AI.EMP_NO			--사번																												");
//			sql.append("\r\n").append("												AND     A.YYYYMMDD   BETWEEN    REPLACE('"+hmCondition.get("s_date")+"' , '-' , '')  AND    REPLACE('"+hmCondition.get("e_date")+"' , '-' , '')		");
//			sql.append("\r\n").append("									) IO_IN																																							");
//			sql.append("\r\n").append("								WHERE	IO_CD.YYYYMMDD = IO_IN.YYYYMMDD																																");
//			sql.append("\r\n").append("										AND																																							");
//			sql.append("\r\n").append("										IO_CD.EMP_NO = IO_IN.EMP_NO																																	");
//			sql.append("\r\n").append("										AND 																																						");
//			sql.append("\r\n").append("										IO_CD.IN_OUT_TP = IO_IN.IN_OUT_TP																															");
//			sql.append("\r\n").append("							) IO ,																																									");
//			sql.append("\r\n").append("							V_DEPT	VD																																								");
//			sql.append("\r\n").append("							WHERE IO.EMP_NO = VD.EMP_NO	AND 	VD.EMP_NO = 	"+emp_no+"																											");
//			sql.append("\r\n").append("					) XX LEFT OUTER JOIN TB_COMM_CD 	C 		ON 	XX.IN_OUT_PLACE 	= 	C.CD 			--출퇴근지명칭 																			");
//			sql.append("\r\n").append("					LEFT JOIN TB_COMM_CD 				A_CD 	ON 	XX.ADVANTAGE 		= 	A_CD.CD			--휴가반영 																				");
//			sql.append("\r\n").append("					LEFT JOIN TB_EMP 					E 		ON 	XX.APPROV_EMP_NO 	= 	E.EMP_NO		--확인자 																					");
//			sql.append("\r\n").append("					LEFT JOIN TB_ATTEND_CLOSE 			F 		ON  XX.YYYYMMDD 		=	F.CLOSE_DT		--마감여부 																				");
//			sql.append("\r\n").append("					     --JOIN TB_AUTH_DEPT 				AZ 		ON 	XX.TEAM_NO 			= 	AZ.DEPT_NO 	 	AND 	AZ.EMP_NO =	"+emp_no+" 															");
//			
//			sql.append("\r\n").append("					/*출근유형 AND 퇴근유형 START*/																																						");
//			sql.append("\r\n").append("						 JOIN TB_ATTEND				IA		ON  XX.YYYYMMDD			=	IA.YYYYMMDD	AND XX.EMP_NO = IA.EMP_NO	AND IA.IN_OUT_TP = 'I'	");
//			
//			//결근이 선택되지 않았을 경우
//			if (!hmCondition.get("absence_type").equals(CodeMetrix.NN) ) {
//				//출근상세
//				if (!hmCondition.get("chk_in_type").equals(CodeMetrix.ALL)) {
//					sql.append("\r\n").append("						 AND IA.IN_OUT_DETAIL = '"+hmCondition.get("chk_in_type")+"'				");
//				}
//			}
//			
//			sql.append("\r\n").append("						 JOIN TB_ATTEND				OA		ON  XX.YYYYMMDD			=   OA.YYYYMMDD AND XX.EMP_NO = OA.EMP_NO	AND OA.IN_OUT_TP = 'O'	");
//			
//			//결근이 선택되지 않았을 경우
//			if (!hmCondition.get("absence_type").equals(CodeMetrix.NN) ) {
//				if (!hmCondition.get("chk_out_type").equals(CodeMetrix.ALL)) {
//					sql.append("\r\n").append("						 AND OA.IN_OUT_DETAIL = '"+hmCondition.get("chk_out_type")+"'			");
//				}
//			}
//			
//			sql.append("\r\n").append("					/*출근유형 AND 퇴근유형 END*/																																						");
//			sql.append("\r\n").append("																																																	");
//			sql.append("\r\n").append("				WHERE 1	=	1																																										");
//			sql.append("\r\n").append("					  /*조회조건 START*/																																								");
//			sql.append("\r\n").append("					  --AND	GROUP_NO 	LIKE	REPLACE('"+hmCondition.get("sgroup")+"' , 'ALL' , '%')		--	그룹																					");
//			sql.append("\r\n").append("					  --AND 	TEAM_NO		LIKE	REPLACE('"+hmCondition.get("steam")+"' , 'ALL' , '%')		--	팀																						");
//			//sql.append("\r\n").append("					  AND 	XX.EMP_NO	LIKE	REPLACE('"+hmCondition.get("semp_no")+"' , 'ALL' , '%')																								");
//			
//			/**특근조회 S T A R T**/
//			if (hmCondition.get("sp_work_type").equals("SWO")) {
//				
//				if (hmCondition.get("sp_work_gubun").equals(CodeMetrix.ALL)) {
//					
//					sql.append("\r\n").append("					  AND (	IA.IN_OUT_DETAIL IN	(	'0006'	) 																");
//					sql.append("\r\n").append("					  OR 	OA.IN_OUT_DETAIL IN	(	'1005'	,	'1008' 	) 		)											");
//				} else if (hmCondition.get("sp_work_gubun").equals("1005")) {	//철야
//					sql.append("\r\n").append("					  AND 	OA.IN_OUT_DETAIL =		'"+hmCondition.get("sp_work_gubun")+"' 					 				");
//				} else if (hmCondition.get("sp_work_gubun").equals("0006")) {	//
//					sql.append("\r\n").append("					  AND 	IA.IN_OUT_DETAIL =		'"+hmCondition.get("sp_work_gubun")+"' 					 				");
//				}
//				
//			} else if (hmCondition.get("sp_work_type").equals("SWX")) {
//				sql.append("\r\n").append("					  AND (	IA.IN_OUT_DETAIL !=	'0006'	 																");
//				sql.append("\r\n").append("					  AND 	OA.IN_OUT_DETAIL NOT	IN	(	'1005' ,	'1008' 	) 		)											");
//			}
//			/**특근조회 E   N   D**/
//			
//			//추가 휴가반영 검색조건
//			if (hmCondition.get("addVacation").equals("AVO")) {
//				if (hmCondition.get("addVacation_gubun").equals(CodeMetrix.ALL)) {
//					sql.append("\r\n").append("						AND     OA.ADVANTAGE             IN   ( '3302' , '3303' )		--반일 + 일일휴가																			");
//				} else {
//					sql.append("\r\n").append("						AND     OA.ADVANTAGE             =   '"+hmCondition.get("addVacation_gubun")+"'						");
//				}
//			} else	if (hmCondition.get("addVacation").equals("AVX")) {
//				sql.append("\r\n").append("						AND    ( OA.ADVANTAGE             =    '3301' OR LEN(OA.ADVANTAGE) = 0 OR OA.ADVANTAGE = '' )		--반일 + 일일휴가											");
//			}	
//			
//			//사번이 ALL인 경우에 쿼리에서 제외한다.
//			if (!hmCondition.get("semp_no").equals(CodeMetrix.ALL) &&  hmCondition.get("searchEmpNm").equals("")) {
//				sql.append("\r\n").append("					  --AND     XX.EMP_NO                    =   '"+hmCondition.get("semp_no")+"'                    																				");
//			} else
//				
//				//사원검색일 경우 추가됨
//				if ( (hmCondition.get("semp_no").equals(CodeMetrix.ALL) || hmCondition.get("semp_no").equals("")) &&  !hmCondition.get("searchEmpNm").equals("")) {
//					sql.append("\r\n").append("					  --AND     XX.EMP_NM                    LIKE    '"+hmCondition.get("searchEmpNm")+"%'                   																		");
//				}
//			
//			//확인여부가 ALL인경우 쿼리에서 제외시킴
//			if (!hmCondition.get("confirm_yn").equals(CodeMetrix.ALL)) {
//				sql.append("\r\n").append("					  AND     XX.CONFIRM_YN                =   '"+hmCondition.get("confirm_yn")+"' --확인여부																						");
//			}
//			
//			//관리자 변경 여부가 ALL이 아닌경우 쿼리에서 제외시킴
//			if (!hmCondition.get("mgr_change_yn").equals(CodeMetrix.ALL)) {
//				sql.append("\r\n").append("					  AND     XX.MGR_CHANGE_YN             =   '" + hmCondition.get("mgr_change_yn") + "'  --CASE ? WHEN 'ALL' THEN '%' ELSE THEN ? END											");
//			}
//			
//			
//			sql.append("\r\n").append("					  AND   XX.IN_OUT_TP LIKE  	REPLACE('" + hmCondition.get("in_out_tp_condi") + "' , 'ALL' , '%')			--출퇴근분류 																");
//			
//			//결근
//			if (hmCondition.get("absence_type").equals(CodeMetrix.NN) ) {
////		    	sql.append("\r\n").append("				AND	  XX.IN_OUT_DETAIL = '"+hmCondition.get("absence_type")+"'   --결근																											");
//				sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL LIKE	REPLACE('"+hmCondition.get("absence_type")+"' , 'ALL' , '%')	--출퇴근유형상세 																");
//			}
//			
//			/**휴가조회 START**/
//			if(hmCondition.get("vacation_yn").equals("VCO")) {     //휴가여부가 휴가이면,,
//							
//				if (hmCondition.get("vacation_type").equals(CodeMetrix.ALL)) {  //모든 휴가
//					sql.append("\r\n").append("	 AND 	XX.IN_OUT_DETAIL IN ( '0004' , '0005' , '0007' , '0008' , '0009' , '1006' , '1007' , '1009' , '1010' , '1011' , '2001' , '2002' , '2003' , '2004' , '2005'  ) 	");
//					
//				}else if (hmCondition.get("vacation_type").equals("VSO")) {		//연차관련
//					
//					if (hmCondition.get("vacation_gubun").equals(CodeMetrix.ALL)) { //모든 연차관련휴가(연차 + 특별)
//						sql.append("\r\n").append("					  AND XX.IN_OUT_DETAIL  IN ( '0004' , '1006' , '2001' , '0007' , '1009' , '2002'  )	");
//						
//					} else if (hmCondition.get("vacation_gubun").equals("2001")) {	//연차						
//						if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 연차휴가						
//							sql.append("\r\n").append("			 AND 	XX.IN_OUT_DETAIL IN ( '0004' , '1006' , '2001' ) 	 ");
//						}else if(hmCondition.get("vacation_detail").equals("HDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
//							sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0004' AND OA.IN_OUT_DETAIL = '1006') OR (IA.IN_OUT_DETAIL = '2001' AND OA.IN_OUT_DETAIL = '2001')  ");
//						}else if(hmCondition.get("vacation_detail").equals("HHD")) {   //반일휴가 
//							if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
//								sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0004' AND OA.IN_OUT_DETAIL != '1006' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0004' AND OA.IN_OUT_DETAIL = '1006' AND XX.IN_OUT_TP = 'O'))	");
//							}else if(hmCondition.get("h_vacation_type").equals("0004")) {
//								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0004'	AND OA.IN_OUT_DETAIL != '1006' AND XX.IN_OUT_TP = 'I' ");					
//							}else if(hmCondition.get("h_vacation_type").equals("1006")) {
//								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0004'	AND OA.IN_OUT_DETAIL = '1006' AND XX.IN_OUT_TP = 'O' ");								
//							}
//						}
//						//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
//
//					} else if (hmCondition.get("vacation_gubun").equals("2002")) {	//특별
//						if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 특별휴가						
//							sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0007' , '1009' , '2002' ) 	 				");
//						}else if(hmCondition.get("vacation_detail").equals("SDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
//							sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0007' AND OA.IN_OUT_DETAIL = '1009') OR (IA.IN_OUT_DETAIL = '2002' AND OA.IN_OUT_DETAIL = '2002')  ");
//						}else if(hmCondition.get("vacation_detail").equals("SHD")) {   //반일휴가 
//							if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
//								sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0007' AND OA.IN_OUT_DETAIL != '1009' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0007' AND OA.IN_OUT_DETAIL = '1009' AND XX.IN_OUT_TP = 'O'))	");
//							}else if(hmCondition.get("h_vacation_type").equals("0004")) {
//								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0007'	AND OA.IN_OUT_DETAIL != '1009' AND XX.IN_OUT_TP = 'I' ");				
//							}else if(hmCondition.get("h_vacation_type").equals("1006")) {
//								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0007'	AND OA.IN_OUT_DETAIL = '1009' AND XX.IN_OUT_TP = 'O' ");								
//							}
//						}
//						//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
//						
//					} //else if (hmCondition.get("vacation_gubun").equals("HFV")) {	//반일연차
//						//if (hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
//						//	sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN		( '0004' , '1006' ) 	--// 													");
//							
//						//} else if (hmCondition.get("h_vacation_type").equals("0004")) {
//						//	sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL =		'"+hmCondition.get("h_vacation_type")+"'  	--// 				");
//						//} else if (hmCondition.get("h_vacation_type").equals("1006")) {
//						//	sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL =		 '"+hmCondition.get("h_vacation_type")+"'  	--// 				");
//						//}
//						
//					//}
//				}else if (hmCondition.get("vacation_type").equals("VSX")) {		//연차외
//					
//					//if (hmCondition.get("vacation_gubun").equals("HFO")) {	//반일공가
//						
//					//	if (hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
//					//		sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN		( '0005' , '1007' ) 	--// 									");
//					//	} else {
//					//		sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL =		'"+hmCondition.get("h_vacation_type")+"'  	--// 				");
//					//	}
//					//} 
//					//else 
//					if (hmCondition.get("vacation_gubun").equals(CodeMetrix.ALL)) {	// 모든 연차외 휴가(경조+공가+기타)
//						sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0005' , '1007' , '2004' , '0008' , '1010' , '2003' , '0009' , '1011' , '2005'  )   			");
//						//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
//					} else if (hmCondition.get("vacation_gubun").equals("2003")) {	//경조
//						if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 경조휴가						
//							sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0008' , '1010' , '2003' ) 	 				");
//						}else if(hmCondition.get("vacation_detail").equals("FDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
//							sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0008' AND OA.IN_OUT_DETAIL = '1010') OR (IA.IN_OUT_DETAIL = '2003' AND OA.IN_OUT_DETAIL = '2003')  ");
//						}else if(hmCondition.get("vacation_detail").equals("FHD")) {   //반일휴가 
//							if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
//								sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0008' AND OA.IN_OUT_DETAIL != '1010' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0008' AND OA.IN_OUT_DETAIL = '1010' AND XX.IN_OUT_TP = 'O'))	");
//							}else if(hmCondition.get("h_vacation_type").equals("0004")) {
//								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0008'	AND OA.IN_OUT_DETAIL != '1010' AND XX.IN_OUT_TP = 'I' ");				
//							}else if(hmCondition.get("h_vacation_type").equals("1006")) {
//								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0008'	AND OA.IN_OUT_DETAIL = '1010' AND XX.IN_OUT_TP = 'O' ");						
//							}
//						}
//						
//					
//						//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
//					} else if (hmCondition.get("vacation_gubun").equals("2004")) {	//공가
//						if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 공가					
//							sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0005' , '1007' , '2004' ) 	 				");
//						}else if(hmCondition.get("vacation_detail").equals("GDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
//							sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0005' AND OA.IN_OUT_DETAIL = '1007') OR (IA.IN_OUT_DETAIL = '2004' AND OA.IN_OUT_DETAIL = '2004')  ");
//						}else if(hmCondition.get("vacation_detail").equals("GHD")) {   //반일휴가 
//							if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
//								sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0005' AND OA.IN_OUT_DETAIL != '1007' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0005' AND OA.IN_OUT_DETAIL = '1007' AND XX.IN_OUT_TP = 'O'))	");
//							}else if(hmCondition.get("h_vacation_type").equals("0004")) {
//								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0005'	AND OA.IN_OUT_DETAIL != '1007' AND XX.IN_OUT_TP = 'I' ");				
//							}else if(hmCondition.get("h_vacation_type").equals("1006")) {
//								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0005'	AND OA.IN_OUT_DETAIL = '1007' AND XX.IN_OUT_TP = 'O' ");	
//							}							
//						}
//					
//						//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
//					} else if (hmCondition.get("vacation_gubun").equals("2005")) {	//기타
//						if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 기타휴가						
//							sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0009' , '1011' , '2005' ) 	 				");
//						}else if(hmCondition.get("vacation_detail").equals("EDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
//							sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0009' AND OA.IN_OUT_DETAIL = '1011') OR (IA.IN_OUT_DETAIL = '2005' AND OA.IN_OUT_DETAIL = '2005')  ");
//						}else if(hmCondition.get("vacation_detail").equals("EHD")) {   //반일휴가 
//							if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
//								sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0009' AND OA.IN_OUT_DETAIL != '1011' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0009' AND OA.IN_OUT_DETAIL = '1011' AND XX.IN_OUT_TP = 'O'))	");
//							}else if(hmCondition.get("h_vacation_type").equals("0004")) {
//								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0009'	AND OA.IN_OUT_DETAIL != '1011' AND XX.IN_OUT_TP = 'I' ");					
//							}else if(hmCondition.get("h_vacation_type").equals("1006")) {
//								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0009'	AND OA.IN_OUT_DETAIL = '1011' AND XX.IN_OUT_TP = 'O' ");
//							}							
//						}
//					}
//						
//						//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
//				} else {
//						//sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN		('0005' , '1007' , '2003' , '2004' , '2005'  )	--// 				");
//						sql.append("\r\n").append("					  AND (XX.IN_OUT_DETAIL  IN ( '0005' , '1007' ) OR XX.IN_OUT_DETAIL IN ( '2003' , '2004' , '2005'  ) AND XX.IN_OUT_TP = 'O')		");
//					}
//					
//			}
//
//			if(hmCondition.get("vacation_yn").equals("VCX")) {     //휴가여부가 미휴가이면,,
//				sql.append("\r\n").append("		AND 	XX.IN_OUT_DETAIL IN		( '0001' , '0002' , '0003'  , '0006' , '1001' , '1002' , '1003' , '1004' , '1005' , '1008' )   ");
//			}
//			
//			/**휴가조회 END**/			//휴가유형
//			//else if (!hmCondition.get("vacation_type").equals(CodeMetrix.ALL)) {
//			//	sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL LIKE	REPLACE('"+hmCondition.get("vacation_type")+"' , 'ALL' , '%')	--출퇴근유형상세 														");
//			//}
//			
//			sql.append("\r\n").append("					  /*조회조건 END*/																																						");
//			sql.append("\r\n").append("					  																																										");
//			sql.append("\r\n").append("			) Z																																												");
//			
//	        System.out.println("======================================11111\r\n");
//			System.out.println("--근태관리-관리자-근태확인 ROW COUNT11111\r\n" + sql.toString());
//			System.out.println("======================================11111\r\n");
//			
//			logger.info("\n" + sql);
//			
//			pstmt 	= con.prepareStatement(sql.toString());
//			
//			/**************************************************************************/
//			//P A R A M E T E R		V A L U E S		S T A R T
//			/**************************************************************************/
//			/**************************************************************************/
//			//P A R A M E T E R		V A L U E S		E   N   D
//			/**************************************************************************/
//			
//			rs		= pstmt.executeQuery();
//			
//			if (rs.next()) {
//				rowCount	=	Integer.valueOf(rs.getString("ROWCNT"));		//조건조회 결과
//			}
//			
//		} catch (SQLException se) {
//			se.printStackTrace();
//			BaseException dex = new BaseException();                
//			dex.setException(se);
//			dex.setAppReturnCode("10");
//			throw dex;
//		} catch(Exception e) {
//			BaseException dex = new BaseException();                
//			dex.setException(e);
//			dex.setAppReturnCode("20");
//			throw dex;
//		} finally {
//			try {
//				if (pstmt != null) pstmt.close();
//				if (rs != null) rs.close();
//				if(con != null) con.close();
//				
//			} catch(SQLException fse) {
//				BaseException dex = new BaseException();                
//				dex.setException(fse);
//				dex.setAppReturnCode("10");
//				throw dex;
//			}
//		}
//	}
	
public void retrieveReqAttendRowCount(HashMap<String, String> hmCondition , int emp_no) throws BaseException , SQLException {
		
		logger.info(hmCondition);
		
		con = getDataSource().getConnection();
		
		try {
			
			sql	=	new StringBuffer();
			
			sql.setLength(0);
			
			sql.append("\r\n").append("			SELECT COUNT(*)	ROWCNT																																				");
			sql.append("\r\n").append("			FROM																																								");
			sql.append("\r\n").append("			(																																									");
			sql.append("\r\n").append("				SELECT  ROW_NUMBER() OVER( ORDER BY XX.YYYYMMDD DESC , XX.EMP_NO , XX.IN_OUT_TP , XX.GROUP_NO , XX.TEAM_NO ) ROWNUM,											");
			sql.append("\r\n").append("						XX.GROUP_NO				,																																");
			sql.append("\r\n").append("						CASE WHEN CHARINDEX('(' ,XX.GROUP_NM	) = 0 THEN XX.GROUP_NM ELSE SUBSTRING(XX.GROUP_NM , 1 , (CHARINDEX('(' ,XX.GROUP_NM	) - 1))	 END AS GROUP_NM			,		");
			sql.append("\r\n").append("						XX.GROUP_NM 	AS  GROUP_NM_TT			,																												");
			sql.append("\r\n").append("						XX.TEAM_NO				,																																");
			sql.append("\r\n").append("						XX.TEAM_NM				,																																");
			sql.append("\r\n").append("						XX.EMP_NO				,																																");
			sql.append("\r\n").append("						XX.EMP_NM				,																																");
			sql.append("\r\n").append("						XX.IN_OUT_DETAIL		,																																");
			sql.append("\r\n").append("						XX.IN_OUT_DETAIL_NM		,																																");
			sql.append("\r\n").append("						XX.IN_DETAIL			,																																");
			sql.append("\r\n").append("						XX.YYYYMMDD				,																																");
			sql.append("\r\n").append("						SUBSTRING(DATENAME(DW , CONVERT(SMALLDATETIME , XX.YYYYMMDD) ) ,1 ,1) AS  DAYNAME ,																		");
			sql.append("\r\n").append("						XX.IN_OUT_TP			,																																");
			sql.append("\r\n").append("						CASE WHEN XX.IN_OUT_TP = 'I' THEN  '출' ELSE '퇴' END IN_OUT_TP_NM 		,																				");
			sql.append("\r\n").append("						XX.IN_OUT_DT			,																																");
			sql.append("\r\n").append("						SUBSTRING(XX.IN_OUT_TIME,1,2) + ':' + SUBSTRING(XX.IN_OUT_TIME,3,4)	AS IN_OUT_TIME		,																");
			sql.append("\r\n").append("						XX.IN_OUT_PLACE			,																																");
			sql.append("\r\n").append("						C.CD_NM AS IN_OUT_PLACE_NM ,																															");
			sql.append("\r\n").append("						XX.ETC_EMP				,																																");
			sql.append("\r\n").append("						SUBSTRING(XX.ETC_EMP , 1 , 10) AS ETC_EMP_MEMO 	, 																										");
			sql.append("\r\n").append("						XX.ETC_MGR				,																																");
			sql.append("\r\n").append("						XX.REG_IP				,																																");
			sql.append("\r\n").append("						XX.MGR_CHANGE_YN		,																																");
			sql.append("\r\n").append("						XX.UPDATE_DT			,																																");
			sql.append("\r\n").append("						XX.APPROV_EMP_NO		,																																");
			sql.append("\r\n").append("						SUBSTRING(E.EMP_NM , 1, 3)	AS APPROV_EMP_NM		,																									");
			sql.append("\r\n").append("						E.EMP_NM 	AS APPROV_EMP_NM_TT		                ,																									");
			sql.append("\r\n").append("						XX.CONFIRM_YN			,																																");
			sql.append("\r\n").append("						XX.ADVANTAGE			,																																");
			sql.append("\r\n").append("						A_CD.ETC AS ADVANTAGE_NM,																																");
			sql.append("\r\n").append("						CASE WHEN (F.CLOSE_DT is null ) THEN 'N' ELSE 'Y' END  CLOSE_DT																							");
			sql.append("\r\n").append("				FROM																																							");
			sql.append("\r\n").append("				(																																								");
			sql.append("\r\n").append("						SELECT 																																					");
			sql.append("\r\n").append("								--ROW_NUMBER() OVER( ORDER BY IO.YYYYMMDD DESC , IO.EMP_NO , IO.IN_OUT_TP , VD.GROUP_NO , VD.TEAM_NO ) ROWNUM,									");
			sql.append("\r\n").append("								VD.GROUP_NO		,	VD.GROUP_NM,																												");
			sql.append("\r\n").append("								VD.TEAM_NO		,	VD.TEAM_NM,																													");
			sql.append("\r\n").append("								IO.EMP_NO		,	VD.EMP_NM,																													");
			sql.append("\r\n").append("								IO.IN_OUT_DETAIL,	IO.IN_OUT_DETAIL_NM,																										");
			sql.append("\r\n").append("								IO.IN_DETAIL	,																																");
			sql.append("\r\n").append("								IO.YYYYMMDD		,		IO.IN_OUT_TP,				--PK ROW																					");
			sql.append("\r\n").append("																																												");
			sql.append("\r\n").append("								IO.IN_OUT_DT,																																	");
			sql.append("\r\n").append("								IO.IN_OUT_TIME,																																	");
			sql.append("\r\n").append("																																												");
			sql.append("\r\n").append("								IO.IN_OUT_PLACE,																																");
			sql.append("\r\n").append("								IO.IN_OUT_PLACE_NM,																																");
			sql.append("\r\n").append("																																												");
			sql.append("\r\n").append("								IO.ETC_EMP,																																		");
			sql.append("\r\n").append("								IO.ETC_MGR,																																		");
			sql.append("\r\n").append("																																												");
			sql.append("\r\n").append("								IO.REG_IP,																																		");
			sql.append("\r\n").append("																																												");
			sql.append("\r\n").append("								IO.MGR_CHANGE_YN,																																");
			sql.append("\r\n").append("																																												");
			sql.append("\r\n").append("								IO.UPDATE_DT,																																	");
			sql.append("\r\n").append("								IO.APPROV_EMP_NO,																																");
			sql.append("\r\n").append("								IO.CONFIRM_YN,																																	");
			sql.append("\r\n").append("								IO.ADVANTAGE																																	");
			sql.append("\r\n").append("						FROM																																					");
			sql.append("\r\n").append("							(																																					");
			sql.append("\r\n").append("								SELECT  IO_CD.IN_OUT_DETAIL_NM ,																												");
			sql.append("\r\n").append("												IO_IN.*																															");
			sql.append("\r\n").append("								FROM 																																			");
			sql.append("\r\n").append("									(																																			");
			sql.append("\r\n").append("										--출퇴근유형																																");
			sql.append("\r\n").append("										SELECT A.YYYYMMDD , A.IN_OUT_TP , A.EMP_NO , A.IN_OUT_DETAIL, C.GROUP_CD, C.CD_NM AS IN_OUT_DETAIL_NM, C.ETC							");
			sql.append("\r\n").append("											FROM TB_ATTEND A, ( SELECT * FROM TB_COMM_CD WHERE ETC_CD IS NULL AND CD != '0' AND USE_YN = 'Y' ) C								");
			sql.append("\r\n").append("										WHERE A.IN_OUT_DETAIL = C.CD																											");
			sql.append("\r\n").append("									) IO_CD , 																																	");
			sql.append("\r\n").append("									(																																			");
			sql.append("\r\n").append("										--퇴근 ROW에 출근유형 추가																													");
			sql.append("\r\n").append("										SELECT 																																	");
			sql.append("\r\n").append("												AI.IN_OUT_DETAIL AS IN_DETAIL , A.*																								");
			sql.append("\r\n").append("										FROM 																																	");
			sql.append("\r\n").append("												TB_ATTEND A , 																													");
			sql.append("\r\n").append("												(SELECT YYYYMMDD , EMP_NO , IN_OUT_TP , IN_OUT_DETAIL  FROM TB_ATTEND WHERE IN_OUT_TP = 'I') AI									");
			sql.append("\r\n").append("										WHERE	--근태날짜와 사번만 조인																												");
			sql.append("\r\n").append("												A.YYYYMMDD = AI.YYYYMMDD 	--근태날짜																							");
			sql.append("\r\n").append("												AND 																																				");		
			sql.append("\r\n").append("												A.EMP_NO = AI.EMP_NO			--사번																												");
			sql.append("\r\n").append("												AND     A.YYYYMMDD   BETWEEN    REPLACE('"+hmCondition.get("s_date")+"' , '-' , '')  AND    REPLACE('"+hmCondition.get("e_date")+"' , '-' , '')		");
			sql.append("\r\n").append("									) IO_IN																																							");
			sql.append("\r\n").append("								WHERE	IO_CD.YYYYMMDD = IO_IN.YYYYMMDD																																");
			sql.append("\r\n").append("										AND																																							");
			sql.append("\r\n").append("										IO_CD.EMP_NO = IO_IN.EMP_NO																																	");
			sql.append("\r\n").append("										AND 																																						");
			sql.append("\r\n").append("										IO_CD.IN_OUT_TP = IO_IN.IN_OUT_TP																															");
			sql.append("\r\n").append("							) IO ,																																									");
			sql.append("\r\n").append("							V_DEPT	VD																																								");
			sql.append("\r\n").append("							WHERE IO.EMP_NO = VD.EMP_NO	AND 	VD.EMP_NO = 	"+emp_no+"																											");
			sql.append("\r\n").append("					) XX LEFT OUTER JOIN TB_COMM_CD 	C 		ON 	XX.IN_OUT_PLACE 	= 	C.CD 			--출퇴근지명칭 																			");
			sql.append("\r\n").append("					LEFT JOIN TB_COMM_CD 				A_CD 	ON 	XX.ADVANTAGE 		= 	A_CD.CD			--휴가반영 																				");
			sql.append("\r\n").append("					LEFT JOIN TB_EMP 					E 		ON 	XX.APPROV_EMP_NO 	= 	E.EMP_NO		--확인자 																					");
			sql.append("\r\n").append("					LEFT JOIN TB_ATTEND_CLOSE 			F 		ON  XX.YYYYMMDD 		=	F.CLOSE_DT		--마감여부 																				");
			sql.append("\r\n").append("					     --JOIN TB_AUTH_DEPT 				AZ 		ON 	XX.TEAM_NO 			= 	AZ.DEPT_NO 	 	AND 	AZ.EMP_NO =	"+emp_no+" 															");
			
			sql.append("\r\n").append("					/*출근유형 AND 퇴근유형 START*/																																						");
			sql.append("\r\n").append("						 JOIN TB_ATTEND				IA		ON  XX.YYYYMMDD			=	IA.YYYYMMDD	AND XX.EMP_NO = IA.EMP_NO	AND IA.IN_OUT_TP = 'I'	");
			
			//결근이 선택되지 않았을 경우
			if (!hmCondition.get("absence_type").equals(CodeMetrix.NN) ) {
				//출근상세
				if (!hmCondition.get("chk_in_type").equals(CodeMetrix.ALL)) {
					sql.append("\r\n").append("						 AND IA.IN_OUT_DETAIL = '"+hmCondition.get("chk_in_type")+"'				");
				}
			}
			
			sql.append("\r\n").append("						 JOIN TB_ATTEND				OA		ON  XX.YYYYMMDD			=   OA.YYYYMMDD AND XX.EMP_NO = OA.EMP_NO	AND OA.IN_OUT_TP = 'O'	");
			
			//결근이 선택되지 않았을 경우
			if (!hmCondition.get("absence_type").equals(CodeMetrix.NN) ) {
				if (!hmCondition.get("chk_out_type").equals(CodeMetrix.ALL)) {
					sql.append("\r\n").append("						 AND OA.IN_OUT_DETAIL = '"+hmCondition.get("chk_out_type")+"'			");
				}
			}
			
			sql.append("\r\n").append("					/*출근유형 AND 퇴근유형 END*/																																						");
			sql.append("\r\n").append("																																																	");
			sql.append("\r\n").append("				WHERE 1	=	1																																										");
			sql.append("\r\n").append("					  /*조회조건 START*/																																								");
			sql.append("\r\n").append("					  --AND	GROUP_NO 	LIKE	REPLACE('"+hmCondition.get("sgroup")+"' , 'ALL' , '%')		--	그룹																					");
			sql.append("\r\n").append("					  --AND 	TEAM_NO		LIKE	REPLACE('"+hmCondition.get("steam")+"' , 'ALL' , '%')		--	팀																						");
			//sql.append("\r\n").append("					  AND 	XX.EMP_NO	LIKE	REPLACE('"+hmCondition.get("semp_no")+"' , 'ALL' , '%')																								");
			
			/**특근조회 S T A R T**/
			if (hmCondition.get("sp_work_type").equals("SWO")) {
				
				if (hmCondition.get("sp_work_gubun").equals(CodeMetrix.ALL)) {
					
					sql.append("\r\n").append("					  AND (	IA.IN_OUT_DETAIL IN	(	'0006'	) 																");
					sql.append("\r\n").append("					  OR 	OA.IN_OUT_DETAIL IN	(	'1005'	,	'1008' 	) 		)											");
				} else if (hmCondition.get("sp_work_gubun").equals("1005")) {	//철야
					sql.append("\r\n").append("					  AND 	OA.IN_OUT_DETAIL =		'"+hmCondition.get("sp_work_gubun")+"' 					 				");
				} else if (hmCondition.get("sp_work_gubun").equals("0006")) {	//
					sql.append("\r\n").append("					  AND 	IA.IN_OUT_DETAIL =		'"+hmCondition.get("sp_work_gubun")+"' 					 				");
				}
				
			} else if (hmCondition.get("sp_work_type").equals("SWX")) {
				sql.append("\r\n").append("					  AND (	IA.IN_OUT_DETAIL !=	'0006'	 																");
				sql.append("\r\n").append("					  AND 	OA.IN_OUT_DETAIL NOT	IN	(	'1005' ,	'1008' 	) 		)											");
			}
			/**특근조회 E   N   D**/
			
			//추가 휴가반영 검색조건
			if (hmCondition.get("addVacation").equals("AVO")) {
				if (hmCondition.get("addVacation_gubun").equals(CodeMetrix.ALL)) {
					sql.append("\r\n").append("						AND     OA.ADVANTAGE             IN   ( '3302' , '3303' )		--반일 + 일일휴가																			");
				} else {
					sql.append("\r\n").append("						AND     OA.ADVANTAGE             =   '"+hmCondition.get("addVacation_gubun")+"'						");
				}
			} else	if (hmCondition.get("addVacation").equals("AVX")) {
				sql.append("\r\n").append("						AND    ( OA.ADVANTAGE             =    '3301' OR LEN(OA.ADVANTAGE) = 0 OR OA.ADVANTAGE = '' )		--반일 + 일일휴가											");
			}	
			
			//사번이 ALL인 경우에 쿼리에서 제외한다.
			if (!hmCondition.get("semp_no").equals(CodeMetrix.ALL) &&  hmCondition.get("searchEmpNm").equals("")) {
				sql.append("\r\n").append("					  --AND     XX.EMP_NO                    =   '"+hmCondition.get("semp_no")+"'                    																				");
			} else
				
				//사원검색일 경우 추가됨
				if ( (hmCondition.get("semp_no").equals(CodeMetrix.ALL) || hmCondition.get("semp_no").equals("")) &&  !hmCondition.get("searchEmpNm").equals("")) {
					sql.append("\r\n").append("					  --AND     XX.EMP_NM                    LIKE    '"+hmCondition.get("searchEmpNm")+"%'                   																		");
				}
			
			//확인여부가 ALL인경우 쿼리에서 제외시킴
			if (!hmCondition.get("confirm_yn").equals(CodeMetrix.ALL)) {
				sql.append("\r\n").append("					  AND     XX.CONFIRM_YN                =   '"+hmCondition.get("confirm_yn")+"' --확인여부																						");
			}
			
			//관리자 변경 여부가 ALL이 아닌경우 쿼리에서 제외시킴
			if (!hmCondition.get("mgr_change_yn").equals(CodeMetrix.ALL)) {
				sql.append("\r\n").append("					  AND     XX.MGR_CHANGE_YN             =   '" + hmCondition.get("mgr_change_yn") + "'  --CASE ? WHEN 'ALL' THEN '%' ELSE THEN ? END											");
			}
			
			
			sql.append("\r\n").append("					  AND   XX.IN_OUT_TP LIKE  	REPLACE('" + hmCondition.get("in_out_tp_condi") + "' , 'ALL' , '%')			--출퇴근분류 																");
			
			//결근
			if (hmCondition.get("absence_type").equals(CodeMetrix.NN) ) {
//		    	sql.append("\r\n").append("				AND	  XX.IN_OUT_DETAIL = '"+hmCondition.get("absence_type")+"'   --결근																											");
				sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL LIKE	REPLACE('"+hmCondition.get("absence_type")+"' , 'ALL' , '%')	--출퇴근유형상세 																");
			}
			
			/**휴가조회 START**/
			if(hmCondition.get("vacation_yn").equals("VCO")) {     //휴가여부가 휴가이면,,
							
				if (hmCondition.get("vacation_type").equals(CodeMetrix.ALL)) {  //모든 휴가
					sql.append("\r\n").append("	 AND 	XX.IN_OUT_DETAIL IN ( '0004' , '0005' , '0007' , '0008' , '0009' , '1006' , '1007' , '1009' , '1010' , '1011' , '2001' , '2002' , '2003' , '2004' , '2005'  ) 	");
					
				}else if (hmCondition.get("vacation_type").equals("VSO")) {		//연차관련
					
					if (hmCondition.get("vacation_gubun").equals(CodeMetrix.ALL)) { //모든 연차관련휴가(연차 + 특별)
						sql.append("\r\n").append("					  AND XX.IN_OUT_DETAIL  IN ( '0004' , '1006' , '2001' , '0007' , '1009' , '2002'  )	");
						
					} else if (hmCondition.get("vacation_gubun").equals("2001")) {	//연차						
						if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 연차휴가						
							sql.append("\r\n").append("			 AND 	XX.IN_OUT_DETAIL IN ( '0004' , '1006' , '2001' ) 	 ");
						}else if(hmCondition.get("vacation_detail").equals("HDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
							sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0004' AND OA.IN_OUT_DETAIL = '1006') OR (IA.IN_OUT_DETAIL = '2001' AND OA.IN_OUT_DETAIL = '2001')  ");
						}else if(hmCondition.get("vacation_detail").equals("HHD")) {   //반일휴가 
							if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
								sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0004' AND OA.IN_OUT_DETAIL != '1006' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0004' AND OA.IN_OUT_DETAIL = '1006' AND XX.IN_OUT_TP = 'O'))	");
							}else if(hmCondition.get("h_vacation_type").equals("0004")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0004'	AND OA.IN_OUT_DETAIL != '1006' AND XX.IN_OUT_TP = 'I' ");					
							}else if(hmCondition.get("h_vacation_type").equals("1006")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0004'	AND OA.IN_OUT_DETAIL = '1006' AND XX.IN_OUT_TP = 'O' ");								
							}
						}
						//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");

					} else if (hmCondition.get("vacation_gubun").equals("2002")) {	//특별
						if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 특별휴가						
							sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0007' , '1009' , '2002' ) 	 				");
						}else if(hmCondition.get("vacation_detail").equals("SDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
							sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0007' AND OA.IN_OUT_DETAIL = '1009') OR (IA.IN_OUT_DETAIL = '2002' AND OA.IN_OUT_DETAIL = '2002')  ");
						}else if(hmCondition.get("vacation_detail").equals("SHD")) {   //반일휴가 
							if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
								sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0007' AND OA.IN_OUT_DETAIL != '1009' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0007' AND OA.IN_OUT_DETAIL = '1009' AND XX.IN_OUT_TP = 'O'))	");
							}else if(hmCondition.get("h_vacation_type").equals("0004")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0007'	AND OA.IN_OUT_DETAIL != '1009' AND XX.IN_OUT_TP = 'I' ");				
							}else if(hmCondition.get("h_vacation_type").equals("1006")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0007'	AND OA.IN_OUT_DETAIL = '1009' AND XX.IN_OUT_TP = 'O' ");								
							}
						}
						//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
						
					} //else if (hmCondition.get("vacation_gubun").equals("HFV")) {	//반일연차
						//if (hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
						//	sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN		( '0004' , '1006' ) 	--// 													");
							
						//} else if (hmCondition.get("h_vacation_type").equals("0004")) {
						//	sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL =		'"+hmCondition.get("h_vacation_type")+"'  	--// 				");
						//} else if (hmCondition.get("h_vacation_type").equals("1006")) {
						//	sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL =		 '"+hmCondition.get("h_vacation_type")+"'  	--// 				");
						//}
						
					//}
				}else if (hmCondition.get("vacation_type").equals("VSX")) {		//연차외
					
					//if (hmCondition.get("vacation_gubun").equals("HFO")) {	//반일공가
						
					//	if (hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
					//		sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN		( '0005' , '1007' ) 	--// 									");
					//	} else {
					//		sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL =		'"+hmCondition.get("h_vacation_type")+"'  	--// 				");
					//	}
					//} 
					//else 
					if (hmCondition.get("vacation_gubun").equals(CodeMetrix.ALL)) {	// 모든 연차외 휴가(경조+공가+기타)
						sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0005' , '1007' , '2004' , '0008' , '1010' , '2003' , '0009' , '1011' , '2005'  )   			");
						//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
					} else if (hmCondition.get("vacation_gubun").equals("2003")) {	//경조
						if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 경조휴가						
							sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0008' , '1010' , '2003' ) 	 				");
						}else if(hmCondition.get("vacation_detail").equals("FDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
							sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0008' AND OA.IN_OUT_DETAIL = '1010') OR (IA.IN_OUT_DETAIL = '2003' AND OA.IN_OUT_DETAIL = '2003')  ");
						}else if(hmCondition.get("vacation_detail").equals("FHD")) {   //반일휴가 
							if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
								sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0008' AND OA.IN_OUT_DETAIL != '1010' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0008' AND OA.IN_OUT_DETAIL = '1010' AND XX.IN_OUT_TP = 'O'))	");
							}else if(hmCondition.get("h_vacation_type").equals("0004")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0008'	AND OA.IN_OUT_DETAIL != '1010' AND XX.IN_OUT_TP = 'I' ");				
							}else if(hmCondition.get("h_vacation_type").equals("1006")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0008'	AND OA.IN_OUT_DETAIL = '1010' AND XX.IN_OUT_TP = 'O' ");						
							}
						}
						
					
						//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
					} else if (hmCondition.get("vacation_gubun").equals("2004")) {	//공가
						if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 공가					
							sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0005' , '1007' , '2004' ) 	 				");
						}else if(hmCondition.get("vacation_detail").equals("GDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
							sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0005' AND OA.IN_OUT_DETAIL = '1007') OR (IA.IN_OUT_DETAIL = '2004' AND OA.IN_OUT_DETAIL = '2004')  ");
						}else if(hmCondition.get("vacation_detail").equals("GHD")) {   //반일휴가 
							if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
								sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0005' AND OA.IN_OUT_DETAIL != '1007' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0005' AND OA.IN_OUT_DETAIL = '1007' AND XX.IN_OUT_TP = 'O'))	");
							}else if(hmCondition.get("h_vacation_type").equals("0004")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0005'	AND OA.IN_OUT_DETAIL != '1007' AND XX.IN_OUT_TP = 'I' ");				
							}else if(hmCondition.get("h_vacation_type").equals("1006")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0005'	AND OA.IN_OUT_DETAIL = '1007' AND XX.IN_OUT_TP = 'O' ");	
							}							
						}
					
						//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
					} else if (hmCondition.get("vacation_gubun").equals("2005")) {	//기타
						if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 기타휴가						
							sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0009' , '1011' , '2005' ) 	 				");
						}else if(hmCondition.get("vacation_detail").equals("EDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
							sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0009' AND OA.IN_OUT_DETAIL = '1011') OR (IA.IN_OUT_DETAIL = '2005' AND OA.IN_OUT_DETAIL = '2005')  ");
						}else if(hmCondition.get("vacation_detail").equals("EHD")) {   //반일휴가 
							if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
								sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0009' AND OA.IN_OUT_DETAIL != '1011' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0009' AND OA.IN_OUT_DETAIL = '1011' AND XX.IN_OUT_TP = 'O'))	");
							}else if(hmCondition.get("h_vacation_type").equals("0004")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0009'	AND OA.IN_OUT_DETAIL != '1011' AND XX.IN_OUT_TP = 'I' ");					
							}else if(hmCondition.get("h_vacation_type").equals("1006")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0009'	AND OA.IN_OUT_DETAIL = '1011' AND XX.IN_OUT_TP = 'O' ");
							}							
						}
					}
						
						//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
				} else {
						//sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN		('0005' , '1007' , '2003' , '2004' , '2005'  )	--// 				");
						sql.append("\r\n").append("					  AND (XX.IN_OUT_DETAIL  IN ( '0005' , '1007' ) OR XX.IN_OUT_DETAIL IN ( '2003' , '2004' , '2005'  ) AND XX.IN_OUT_TP = 'O')		");
					}
					
			}

			if(hmCondition.get("vacation_yn").equals("VCX")) {     //휴가여부가 미휴가이면,,
				sql.append("\r\n").append("		AND 	XX.IN_OUT_DETAIL IN		( '0001' , '0002' , '0003'  , '0006' , '1001' , '1002' , '1003' , '1004' , '1005' , '1008' )   ");
			}
			
			/**휴가조회 END**/			//휴가유형
			//else if (!hmCondition.get("vacation_type").equals(CodeMetrix.ALL)) {
			//	sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL LIKE	REPLACE('"+hmCondition.get("vacation_type")+"' , 'ALL' , '%')	--출퇴근유형상세 														");
			//}
			
			sql.append("\r\n").append("					  /*조회조건 END*/																																						");
			sql.append("\r\n").append("					  																																										");
			sql.append("\r\n").append("			) Z																																												");
			
	        System.out.println("======================================11111\r\n");
			System.out.println("--근태관리-관리자-근태확인 ROW COUNT11111\r\n" + sql.toString());
			System.out.println("======================================11111\r\n");
			
			logger.info("\n" + sql);
			
			pstmt 	= con.prepareStatement(sql.toString());
			
			/**************************************************************************/
			//P A R A M E T E R		V A L U E S		S T A R T
			/**************************************************************************/
			/**************************************************************************/
			//P A R A M E T E R		V A L U E S		E   N   D
			/**************************************************************************/
			
			rs		= pstmt.executeQuery();
			
			if (rs.next()) {
				rowCount	=	Integer.valueOf(rs.getString("ROWCNT"));		//조건조회 결과
			}
			
		} catch (SQLException se) {
			se.printStackTrace();
			BaseException dex = new BaseException();                
			dex.setException(se);
			dex.setAppReturnCode("10");
			throw dex;
		} catch(Exception e) {
			BaseException dex = new BaseException();                
			dex.setException(e);
			dex.setAppReturnCode("20");
			throw dex;
		} finally {
			try {
				if (pstmt != null) pstmt.close();
				if (rs != null) rs.close();
				if(con != null) con.close();
				
			} catch(SQLException fse) {
				BaseException dex = new BaseException();                
				dex.setException(fse);
				dex.setAppReturnCode("10");
				throw dex;
			}
		}
	}
	
public void retrieveAttendLateRowCount(HashMap<String, String> hmCondition , int emp_no, String e_date) throws BaseException , SQLException {
		
		logger.info(hmCondition);
		
		con = getDataSource().getConnection();
		
		try {

			sql	=	new StringBuffer();
			
			sql.setLength(0);
			
			sql.append("\r\n").append("			SELECT COUNT(*)	ROWCNT																																				");
			sql.append("\r\n").append("			FROM																																								");
			sql.append("\r\n").append("			(																																									");
			sql.append("\r\n").append("				SELECT  ROW_NUMBER() OVER( ORDER BY XX.YYYYMMDD DESC , XX.EMP_NO , XX.IN_OUT_TP , XX.GROUP_NO , XX.TEAM_NO ) ROWNUM,											");
			sql.append("\r\n").append("						XX.GROUP_NO				,																																");
			sql.append("\r\n").append("						CASE WHEN CHARINDEX('(' ,XX.GROUP_NM	) = 0 THEN XX.GROUP_NM ELSE SUBSTRING(XX.GROUP_NM , 1 , (CHARINDEX('(' ,XX.GROUP_NM	) - 1))	 END AS GROUP_NM			,		");
			sql.append("\r\n").append("						XX.GROUP_NM 	AS  GROUP_NM_TT			,																												");
			sql.append("\r\n").append("						XX.TEAM_NO				,																																");
			sql.append("\r\n").append("						XX.TEAM_NM				,																																");
			sql.append("\r\n").append("						XX.EMP_NO				,																																");
			sql.append("\r\n").append("						XX.EMP_NM				,																																");
			//sql.append("\r\n").append("						XX.WORK_YN				,																																");//
			sql.append("\r\n").append("						XX.IN_OUT_DETAIL		,																																");
			sql.append("\r\n").append("						XX.IN_OUT_DETAIL_NM		,																																");
			sql.append("\r\n").append("						XX.IN_DETAIL			,																																");
			sql.append("\r\n").append("						XX.YYYYMMDD				,																																");
			sql.append("\r\n").append("						SUBSTRING(DATENAME(DW , CONVERT(SMALLDATETIME , XX.YYYYMMDD) ) ,1 ,1) AS  DAYNAME ,																		");
			sql.append("\r\n").append("						XX.IN_OUT_TP			,																																");
			sql.append("\r\n").append("						CASE WHEN XX.IN_OUT_TP = 'I' THEN  '출' ELSE '퇴' END IN_OUT_TP_NM 		,																				");
			sql.append("\r\n").append("						XX.IN_OUT_DT			,																																");
			sql.append("\r\n").append("						SUBSTRING(XX.IN_OUT_TIME,1,2) + ':' + SUBSTRING(XX.IN_OUT_TIME,3,4)	AS IN_OUT_TIME		,																");
			sql.append("\r\n").append("						XX.IN_OUT_PLACE			,																																");
			sql.append("\r\n").append("						C.CD_NM AS IN_OUT_PLACE_NM ,																															");
			sql.append("\r\n").append("						XX.ETC_EMP				,																																");
			sql.append("\r\n").append("						SUBSTRING(XX.ETC_EMP , 1 , 10) AS ETC_EMP_MEMO 	, 																										");
			sql.append("\r\n").append("						XX.ETC_MGR				,																																");
			sql.append("\r\n").append("						XX.REG_IP				,																																");
			sql.append("\r\n").append("						XX.MGR_CHANGE_YN		,																																");
			sql.append("\r\n").append("						XX.UPDATE_DT			,																																");
			sql.append("\r\n").append("						XX.APPROV_EMP_NO		,																																");
			sql.append("\r\n").append("						SUBSTRING(E.EMP_NM , 1, 3)	AS APPROV_EMP_NM		,																									");
			sql.append("\r\n").append("						E.EMP_NM 	AS APPROV_EMP_NM_TT		                ,																									");
			sql.append("\r\n").append("						XX.CONFIRM_YN			,																																");
			sql.append("\r\n").append("						XX.ADVANTAGE			,																																");
			sql.append("\r\n").append("						A_CD.ETC AS ADVANTAGE_NM,																																");
			sql.append("\n").append(" 	DBO.FNC_GET_VACATION_WORK(E.APPLY_DT,'"+e_date+"','VACA_S_DATE') AS VACA_S_DATE,                                                                                            ");
			sql.append("\n").append(" 	DBO.FNC_GET_VACATION_WORK(E.APPLY_DT,'"+e_date+"','VACA_E_DATE') AS VACA_E_DATE,                                                                                            ");

			sql.append("\r\n").append("						CASE WHEN (F.CLOSE_DT is null ) THEN 'N' ELSE 'Y' END  CLOSE_DT																							");
			sql.append("\r\n").append("				FROM																																							");
			sql.append("\r\n").append("				(																																								");
			sql.append("\r\n").append("						SELECT 																																					");
			sql.append("\r\n").append("								--ROW_NUMBER() OVER( ORDER BY IO.YYYYMMDD DESC , IO.EMP_NO , IO.IN_OUT_TP , VD.GROUP_NO , VD.TEAM_NO ) ROWNUM,									");
			sql.append("\r\n").append("								VD.GROUP_NO		,	VD.GROUP_NM,																												");
			sql.append("\r\n").append("								VD.TEAM_NO		,	VD.TEAM_NM,																													");
			sql.append("\r\n").append("								IO.EMP_NO		,	VD.EMP_NM,																													");
			sql.append("\r\n").append("								IO.IN_OUT_DETAIL,	IO.IN_OUT_DETAIL_NM,																										");
			sql.append("\r\n").append("								IO.IN_DETAIL	,																																");
			sql.append("\r\n").append("								IO.YYYYMMDD		,		IO.IN_OUT_TP,				--PK ROW																					");
			sql.append("\r\n").append("																																												");
			sql.append("\r\n").append("								IO.IN_OUT_DT,																																	");
			sql.append("\r\n").append("								IO.IN_OUT_TIME,																																	");
			sql.append("\r\n").append("																																												");
			sql.append("\r\n").append("								IO.IN_OUT_PLACE,																																");
			sql.append("\r\n").append("								IO.IN_OUT_PLACE_NM,																																");
			sql.append("\r\n").append("																																												");
			sql.append("\r\n").append("								IO.ETC_EMP,																																		");
			sql.append("\r\n").append("								IO.ETC_MGR,																																		");
			sql.append("\r\n").append("																																												");
			sql.append("\r\n").append("								IO.REG_IP,																																		");
			sql.append("\r\n").append("																																												");
			sql.append("\r\n").append("								IO.MGR_CHANGE_YN,																																");
			sql.append("\r\n").append("																																												");
			sql.append("\r\n").append("								IO.UPDATE_DT,																																	");
			sql.append("\r\n").append("								IO.APPROV_EMP_NO,																																");
			sql.append("\r\n").append("								IO.CONFIRM_YN,																																	");
			sql.append("\r\n").append("								IO.ADVANTAGE																																	");
			sql.append("\r\n").append("						FROM																																					");
			sql.append("\r\n").append("							(																																					");
			sql.append("\r\n").append("								SELECT  IO_CD.IN_OUT_DETAIL_NM ,																												");
			sql.append("\r\n").append("												IO_IN.*																															");
			sql.append("\r\n").append("								FROM 																																			");
			sql.append("\r\n").append("									(																																			");
			sql.append("\r\n").append("										--출퇴근유형																																");
			sql.append("\r\n").append("										SELECT A.YYYYMMDD , A.IN_OUT_TP , A.EMP_NO , A.IN_OUT_DETAIL, C.GROUP_CD, C.CD_NM AS IN_OUT_DETAIL_NM, C.ETC							");
			sql.append("\r\n").append("											FROM TB_ATTEND A, ( SELECT * FROM TB_COMM_CD WHERE ETC_CD IS NULL AND CD != '0' AND USE_YN = 'Y' ) C								");
			sql.append("\r\n").append("										WHERE A.IN_OUT_DETAIL = C.CD																											");
			sql.append("\r\n").append("									) IO_CD , 																																	");
			sql.append("\r\n").append("									(																																			");
			sql.append("\r\n").append("										--퇴근 ROW에 출근유형 추가																													");
			sql.append("\r\n").append("										SELECT 																																	");
			sql.append("\r\n").append("												AI.IN_OUT_DETAIL AS IN_DETAIL , A.*																								");
			sql.append("\r\n").append("										FROM 																																	");
			sql.append("\r\n").append("												TB_ATTEND A , 																													");
			sql.append("\r\n").append("												(SELECT YYYYMMDD , EMP_NO , IN_OUT_TP , IN_OUT_DETAIL  FROM TB_ATTEND WHERE IN_OUT_TP = 'I') AI									");
			sql.append("\r\n").append("										WHERE	--근태날짜와 사번만 조인																												");
			sql.append("\r\n").append("												A.YYYYMMDD = AI.YYYYMMDD 	--근태날짜																							");
			sql.append("\r\n").append("												AND 																																				");		
			sql.append("\r\n").append("												A.EMP_NO = AI.EMP_NO			--사번																												");
			//sql.append("\r\n").append("												AND     A.YYYYMMDD   =   REPLACE('"+hmCondition.get("e_date")+"' , '-' , '')		                                            ");
			sql.append("\r\n").append("									) IO_IN																																							");
			sql.append("\r\n").append("								WHERE	IO_CD.YYYYMMDD = IO_IN.YYYYMMDD																																");
			sql.append("\r\n").append("										AND																																							");
			sql.append("\r\n").append("										IO_CD.EMP_NO = IO_IN.EMP_NO																																	");
			sql.append("\r\n").append("										AND 																																						");
			sql.append("\r\n").append("										IO_CD.IN_OUT_TP = IO_IN.IN_OUT_TP																															");
			sql.append("\r\n").append("							) IO ,																																									");
			sql.append("\r\n").append("							V_DEPT	VD																																								");
			sql.append("\r\n").append("							WHERE IO.EMP_NO = VD.EMP_NO	AND 	VD.EMP_NO != 	"+emp_no+"																											");
			sql.append("\r\n").append("					) XX LEFT OUTER JOIN TB_COMM_CD 	C 		ON 	XX.IN_OUT_PLACE 	= 	C.CD 			--출퇴근지명칭 																			");
			sql.append("\r\n").append("					LEFT JOIN TB_COMM_CD 				A_CD 	ON 	XX.ADVANTAGE 		= 	A_CD.CD			--휴가반영 																				");
			//sql.append("\r\n").append("					LEFT JOIN TB_EMP 					E 		ON 	XX.APPROV_EMP_NO 	= 	E.EMP_NO		--확인자 																					");
			sql.append("\r\n").append("					LEFT JOIN TB_EMP 					E 		ON 	XX.EMP_NO 	= 	E.EMP_NO		--확인자                                                                                                                                                                                                                                            ");
			sql.append("\r\n").append("					LEFT JOIN TB_ATTEND_CLOSE 			F 		ON  XX.YYYYMMDD 		=	F.CLOSE_DT		--마감여부 																				");
			sql.append("\r\n").append("					     JOIN TB_AUTH_DEPT 				AZ 		ON 	XX.TEAM_NO 			= 	AZ.DEPT_NO 	 	AND 	AZ.EMP_NO =	"+emp_no+" 															");
			
			sql.append("\r\n").append("					/*출근유형 AND 퇴근유형 START*/																																						");
			sql.append("\r\n").append("						 JOIN TB_ATTEND				IA		ON  XX.YYYYMMDD			=	IA.YYYYMMDD	AND XX.EMP_NO = IA.EMP_NO	AND IA.IN_OUT_TP = 'I'	");
			
			//결근이 선택되지 않았을 경우
		    if (hmCondition.get("late_absence").equals("ALL")) {
		    	//출근상세
		    	//if (!hmCondition.get("chk_in_type").equals(CodeMetrix.ALL)) {
	        		sql.append("\r\n").append("						 AND IA.IN_OUT_DETAIL IN ('0002','NN')				");
	        		sql.append("\r\n").append("						 AND IA.IN_OUT_DETAIL != 'XX'				");
	        		//sql.append("\r\n").append("						 AND XX.WORK_YN = 'Y'        		    ");
	        	//}
		    }
		    if (hmCondition.get("late_absence").equals("NN")){
		    	sql.append("\r\n").append("						 AND IA.IN_OUT_DETAIL = 'NN'				");    		    	
		    }
		    if (hmCondition.get("late_absence").equals("0002")){
		    	sql.append("\r\n").append("						 AND IA.IN_OUT_DETAIL = '0002'				"); 		    	
 		    }
		  //사번이 ALL인 경우에 쿼리에서 제외한다.
			if (!hmCondition.get("semp_no").equals(CodeMetrix.ALL) &&  hmCondition.get("searchEmpNm").equals("")) {
				sql.append("\r\n").append("					  AND     XX.EMP_NO                    =   '"+hmCondition.get("semp_no")+"'                    																				");
			} else
			
			//사원검색일 경우 추가됨
			if ( (hmCondition.get("semp_no").equals(CodeMetrix.ALL) || hmCondition.get("semp_no").equals("")) &&  !hmCondition.get("searchEmpNm").equals("")) {
				sql.append("\r\n").append("					  AND     XX.EMP_NM                    LIKE    '"+hmCondition.get("searchEmpNm")+"%'                   																		");
			}
			if(!hmCondition.get("e_date").equals("")){
				sql.append("\r\n").append("  AND  '"+e_date+"' >=  XX.YYYYMMDD      ");
			       sql.append("\r\n").append(" 	AND  DBO.FNC_GET_VACATION_WORK(E.APPLY_DT,'"+e_date+"','VACA_S_DATE') <= XX.YYYYMMDD           ");
			}
			sql.append("\r\n").append("					  /*조회조건 END*/																																						");
			sql.append("\r\n").append("					  AND	GROUP_NO 	LIKE	REPLACE('"+hmCondition.get("sgroup")+"' , 'ALL' , '%')		--	그룹			");
			sql.append("\r\n").append("					  AND 	TEAM_NO		LIKE	REPLACE('"+hmCondition.get("steam")+"' , 'ALL' , '%')		--	팀			");											
		    sql.append("\r\n").append("					  AND XX.IN_OUT_TP = 'I'				");
		    
			sql.append("\r\n").append("					  																																										");
			sql.append("\r\n").append("			) Z																																												");
//	        System.out.println("1111======================================22222\r\n");
//			System.out.println("--근태관리-관리자-근태확인22222 1 ROW COUNT\r\n" + sql.toString());
//			System.out.println("1111======================================22222\r\n");
			pstmt 	= con.prepareStatement(sql.toString());
		

			/**************************************************************************/
			//P A R A M E T E R		V A L U E S		S T A R T
			/**************************************************************************/
			/**************************************************************************/
			//P A R A M E T E R		V A L U E S		E   N   D
			/**************************************************************************/

			rs		= pstmt.executeQuery();

			if (rs.next()) {
				rowCount	=	Integer.valueOf(rs.getString("ROWCNT"));		//조건조회 결과
			}
			
		} catch (SQLException se) {
			se.printStackTrace();
			BaseException dex = new BaseException();                
			dex.setException(se);
			dex.setAppReturnCode("10");
			throw dex;
		} catch(Exception e) {
			BaseException dex = new BaseException();                
			dex.setException(e);
			dex.setAppReturnCode("20");
			throw dex;
		} finally {
			try {
				if (pstmt != null) pstmt.close();
				if (rs != null) rs.close();
				if(con != null) con.close();

			} catch(SQLException fse) {
				BaseException dex = new BaseException();                
				dex.setException(fse);
				dex.setAppReturnCode("10");
				throw dex;
			}
		}
	}

public void retrieveReqManagerRowCnt(HashMap<String, String> hmCondition , int emp_no) throws BaseException , SQLException {
	System.out.println("관리자쪽 로우카운트");
	logger.info(hmCondition);
	
	con = getDataSource().getConnection();
	
	try {
		list = new ArrayList<HashMap<String,String>>();
		
		sql.setLength(0);
		
		sql.append("\r\n").append("			SELECT COUNT(*)	ROWCNT																																				");
		sql.append("\r\n").append("																																									");
		sql.append("\r\n").append("			FROM																																								");
		sql.append("\r\n").append("			(																																									");
		sql.append("\r\n").append("				SELECT  ROW_NUMBER() OVER( ORDER BY XX.YYYYMMDD DESC , XX.EMP_NO , XX.IN_OUT_TP , XX.GROUP_NO , XX.TEAM_NO ) ROWNUM,											");
		sql.append("\r\n").append("						CASE WHEN CHARINDEX('(' ,XX.GROUP_NM	) = 0 THEN XX.GROUP_NM ELSE SUBSTRING(XX.GROUP_NM , 1 , (CHARINDEX('(' ,XX.GROUP_NM	) - 1))	 END AS GROUP_NM			,		");
		sql.append("\r\n").append("						XX.GROUP_NM 	AS  GROUP_NM_TT			,																												");
		sql.append("\r\n").append("						XX.TEAM_NO				,																																");
		sql.append("\r\n").append("						XX.TEAM_NM				,																																");
		sql.append("\r\n").append("						XX.EMP_NO				,																																");
		sql.append("\r\n").append("						XX.EMP_NM				,																																");
		sql.append("\r\n").append("						XX.IN_OUT_DETAIL		,																																");
		sql.append("\r\n").append("						XX.IN_OUT_DETAIL_NM		,																																");
		sql.append("\r\n").append("						XX.IN_DETAIL			,																																");
		sql.append("\r\n").append("						XX.YYYYMMDD				,																																");
		sql.append("\r\n").append("						SUBSTRING(DATENAME(DW , CONVERT(SMALLDATETIME , XX.YYYYMMDD) ) ,1 ,1) AS  DAYNAME ,																		");
		sql.append("\r\n").append("						XX.IN_OUT_TP			,																																");
		sql.append("\r\n").append("						CASE WHEN XX.IN_OUT_TP = 'I' THEN  '출' ELSE '퇴' END IN_OUT_TP_NM 		,																				");
		sql.append("\r\n").append("						SUBSTRING(XX.IN_OUT_DT,5,8) AS IN_OUT_DT			,																									");
		sql.append("\r\n").append("						SUBSTRING(XX.IN_OUT_TIME,1,2) + ':' + SUBSTRING(XX.IN_OUT_TIME,3,4)	AS IN_OUT_TIME		,														    ");
		sql.append("\r\n").append("						XX.IN_OUT_PLACE			,																																");
		sql.append("\r\n").append("						C.CD_NM AS IN_OUT_PLACE_NM ,																															");
		sql.append("\r\n").append("						XX.ETC_EMP				,																																");
		sql.append("\r\n").append("						SUBSTRING(XX.ETC_EMP , 1 , 10) AS ETC_EMP_MEMO 	, 																										");
		sql.append("\r\n").append("						XX.ETC_MGR				,																																");
		sql.append("\r\n").append("						XX.REG_IP				,																																");
		sql.append("\r\n").append("						XX.MGR_CHANGE_YN		,																																");
		sql.append("\r\n").append("						XX.UPDATE_DT			,																																");
		sql.append("\r\n").append("						XX.APPROV_EMP_NO		,																																");
		sql.append("\r\n").append("						SUBSTRING(E.EMP_NM , 1, 3)	AS APPROV_EMP_NM		,																									");
		sql.append("\r\n").append("						E.EMP_NM 	AS APPROV_EMP_NM_TT		                ,																									");
		sql.append("\r\n").append("						XX.CONFIRM_YN			,																																");
		sql.append("\r\n").append("						XX.ADVANTAGE			,																																");
		sql.append("\r\n").append("						A_CD.ETC AS ADVANTAGE_NM,																																");
		sql.append("\r\n").append("                     XX.REQ_YN               ,                                                                                                                               ");
		sql.append("\r\n").append("                     CASE WHEN XX.REQ_YN = 'N' THEN  '요청중' WHEN XX.REQ_YN = 'Y' THEN  '완료' END IN_REQ_YN_NM ,                                                            ");
		sql.append("\r\n").append("						CASE WHEN (F.CLOSE_DT is null ) THEN 'N' ELSE 'Y' END  CLOSE_DT																							");
		sql.append("\r\n").append("				FROM																																							");
		sql.append("\r\n").append("				(																																								");
		sql.append("\r\n").append("						SELECT 																																					");
		sql.append("\r\n").append("								--ROW_NUMBER() OVER( ORDER BY IO.YYYYMMDD DESC , IO.EMP_NO , IO.IN_OUT_TP , VD.GROUP_NO , VD.TEAM_NO ) ROWNUM,									");
		sql.append("\r\n").append("								VD.GROUP_NO		,	VD.GROUP_NM,																												");
		sql.append("\r\n").append("								VD.TEAM_NO		,	VD.TEAM_NM,																													");
		sql.append("\r\n").append("								IO.EMP_NO		,	VD.EMP_NM,																													");
		sql.append("\r\n").append("								IO.IN_OUT_DETAIL,	IO.IN_OUT_DETAIL_NM,																										");
		sql.append("\r\n").append("								IO.IN_DETAIL	,																																");
		sql.append("\r\n").append("								IO.YYYYMMDD		,		IO.IN_OUT_TP,				--PK ROW																					");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.IN_OUT_DT,																																	");
		sql.append("\r\n").append("								IO.IN_OUT_TIME,																																	");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.IN_OUT_PLACE,																																");
		sql.append("\r\n").append("								IO.IN_OUT_PLACE_NM,																																");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.ETC_EMP,																																		");
		sql.append("\r\n").append("								IO.ETC_MGR,																																		");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.REG_IP,																																		");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.MGR_CHANGE_YN,																																");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.UPDATE_DT,																																	");
		sql.append("\r\n").append("								IO.APPROV_EMP_NO,																																");
		sql.append("\r\n").append("								IO.CONFIRM_YN,																																	");
		sql.append("\r\n").append("								IO.ADVANTAGE ,																																	");
		sql.append("\r\n").append("                             IO.REQ_YN                                                                                                                                       ");
		sql.append("\r\n").append("						FROM																																					");
		sql.append("\r\n").append("							(																																					");
		sql.append("\r\n").append("								SELECT  IO_CD.IN_OUT_DETAIL_NM ,																												");
		sql.append("\r\n").append("												IO_IN.*																															");
		sql.append("\r\n").append("								FROM 																																			");
		sql.append("\r\n").append("									(																																			");
		sql.append("\r\n").append("										--출퇴근유형																																");
		sql.append("\r\n").append("										SELECT A.YYYYMMDD , A.IN_OUT_TP , A.EMP_NO , A.IN_OUT_DETAIL, C.GROUP_CD, C.CD_NM AS IN_OUT_DETAIL_NM, C.ETC							");
		sql.append("\r\n").append("											FROM TB_ATTEND A, ( SELECT * FROM TB_COMM_CD WHERE ETC_CD IS NULL AND CD != '0' AND USE_YN = 'Y' ) C								");
		sql.append("\r\n").append("										WHERE A.IN_OUT_DETAIL = C.CD																											");
		sql.append("\r\n").append("									) IO_CD , 																																	");
		sql.append("\r\n").append("									(																																			");
		sql.append("\r\n").append("										--퇴근 ROW에 출근유형 추가																													");
		sql.append("\r\n").append("										SELECT 																																	");
		sql.append("\r\n").append("												AI.IN_OUT_DETAIL AS IN_DETAIL , A.*																								");
		sql.append("\r\n").append("										FROM 																																	");
		sql.append("\r\n").append("												TB_ATTEND A , 																													");
		sql.append("\r\n").append("												(SELECT YYYYMMDD , EMP_NO , IN_OUT_TP , IN_OUT_DETAIL  FROM TB_ATTEND WHERE IN_OUT_TP = 'I') AI									");
		sql.append("\r\n").append("										WHERE	--근태날짜와 사번만 조인																												");
		sql.append("\r\n").append("												A.YYYYMMDD = AI.YYYYMMDD 	--근태날짜																							");
		sql.append("\r\n").append("												AND 																																				");		
		sql.append("\r\n").append("												A.EMP_NO = AI.EMP_NO			--사번																												");
		sql.append("\r\n").append("												AND     A.YYYYMMDD   BETWEEN    REPLACE('"+hmCondition.get("s_date")+"' , '-' , '')  AND    REPLACE('"+hmCondition.get("e_date")+"' , '-' , '')		");
		sql.append("\r\n").append("									) IO_IN																																							");
		sql.append("\r\n").append("								WHERE	IO_CD.YYYYMMDD = IO_IN.YYYYMMDD																																");
		sql.append("\r\n").append("										AND																																							");
		sql.append("\r\n").append("										IO_CD.EMP_NO = IO_IN.EMP_NO																																	");
		sql.append("\r\n").append("										AND 																																						");
		sql.append("\r\n").append("										IO_CD.IN_OUT_TP = IO_IN.IN_OUT_TP																															");
		sql.append("\r\n").append("							) IO ,																																									");
		sql.append("\r\n").append("							V_DEPT	VD																																								");
		sql.append("\r\n").append("							WHERE IO.EMP_NO = VD.EMP_NO	AND 	VD.EMP_NO = 	"+emp_no+"																											");
		sql.append("\r\n").append("					) XX LEFT OUTER JOIN TB_COMM_CD 	C 		ON 	XX.IN_OUT_PLACE 	= 	C.CD 			--출퇴근지명칭 																			");
		sql.append("\r\n").append("					LEFT JOIN TB_COMM_CD 				A_CD 	ON 	XX.ADVANTAGE 		= 	A_CD.CD			--휴가반영 																				");
		sql.append("\r\n").append("					LEFT JOIN TB_EMP 					E 		ON 	XX.APPROV_EMP_NO 	= 	E.EMP_NO		--확인자 																					");
		sql.append("\r\n").append("					LEFT JOIN TB_ATTEND_CLOSE 			F 		ON  XX.YYYYMMDD 		=	F.CLOSE_DT		--마감여부 																				");
		sql.append("\r\n").append("					--     JOIN TB_AUTH_DEPT 				AZ 		ON 	XX.TEAM_NO 			= 	AZ.DEPT_NO 	 	AND 	AZ.EMP_NO =	"+emp_no+" 															");
		sql.append("\r\n").append("																																																	");
		sql.append("\r\n").append("					/*출근유형 AND 퇴근유형 START*/																																						");
		
		sql.append("\r\n").append("						 JOIN TB_ATTEND				IA		ON  XX.YYYYMMDD			=	IA.YYYYMMDD	AND XX.EMP_NO = IA.EMP_NO	AND IA.IN_OUT_TP = 'I'	");
		
		//결근이 선택되지 않았을 경우
	    if (hmCondition.get("req_Change").equals("ALL")) {
	    	//출근상세
	    	//if (!hmCondition.get("chk_in_type").equals(CodeMetrix.ALL)) {
        		sql.append("\r\n").append("						  AND IA.REQ_YN IN ('Y','N')				");
        		//sql.append("\r\n").append("						  AND IA.REQ_YN ='N'					");
        		//sql.append("\r\n").append("						 AND XX.WORK_YN = 'Y'        		    ");
        	//}
	    }
	    if (hmCondition.get("req_Change").equals("Y")){
	    	sql.append("\r\n").append("						 AND IA.REQ_YN = 'Y'				");    		    	
	    }
	    if (hmCondition.get("req_Change").equals("N")){
	    	sql.append("\r\n").append("						 AND IA.REQ_YN = 'N'				"); 		    	
	    }
	  //사번이 ALL인 경우에 쿼리에서 제외한다.
		if (!hmCondition.get("semp_no").equals(CodeMetrix.ALL) &&  hmCondition.get("searchEmpNm").equals("")) {
			sql.append("\r\n").append("					  AND     XX.EMP_NO                    =   '"+hmCondition.get("semp_no")+"'                    																				");
		} else
		
		//사원검색일 경우 추가됨
		if ( (hmCondition.get("semp_no").equals(CodeMetrix.ALL) || hmCondition.get("semp_no").equals("")) &&  !hmCondition.get("searchEmpNm").equals("")) {
			sql.append("\r\n").append("					  AND     XX.EMP_NM                    LIKE    '"+hmCondition.get("searchEmpNm")+"%'                   																		");
		}
		
		sql.append("\r\n").append("					  /*조회조건 END*/																																						");
		sql.append("\r\n").append("					  AND	GROUP_NO 	LIKE	REPLACE('"+hmCondition.get("sgroup")+"' , 'ALL' , '%')		--	그룹			");
		sql.append("\r\n").append("					  AND 	TEAM_NO		LIKE	REPLACE('"+hmCondition.get("steam")+"' , 'ALL' , '%')		--	팀			");											
	    sql.append("\r\n").append("					  AND XX.IN_OUT_TP IN ('I','O')				");
	    
		sql.append("\r\n").append("					  																																										");
		sql.append("\r\n").append("			) Z																																												");
//        System.out.println("1111======================================22222\r\n");
	System.out.println("--근태관리-관리자-근태확인22222 1 ROW COUNT\r\n" + sql.toString());
//		System.out.println("1111======================================22222\r\n");
		pstmt 	= con.prepareStatement(sql.toString());
	

		/**************************************************************************/
		//P A R A M E T E R		V A L U E S		S T A R T
		/**************************************************************************/
		/**************************************************************************/
		//P A R A M E T E R		V A L U E S		E   N   D
		/**************************************************************************/

		rs		= pstmt.executeQuery();

		if (rs.next()) {
			rowCount	=	Integer.valueOf(rs.getString("ROWCNT"));		//조건조회 결과
		}
		
	} catch (SQLException se) {
		se.printStackTrace();
		BaseException dex = new BaseException();                
		dex.setException(se);
		dex.setAppReturnCode("10");
		throw dex;
	} catch(Exception e) {
		BaseException dex = new BaseException();                
		dex.setException(e);
		dex.setAppReturnCode("20");
		throw dex;
	} finally {
		try {
			if (pstmt != null) pstmt.close();
			if (rs != null) rs.close();
			if(con != null) con.close();

		} catch(SQLException fse) {
			BaseException dex = new BaseException();                
			dex.setException(fse);
			dex.setAppReturnCode("10");
			throw dex;
		}
	}
}

public void retireveReqAttendManagerList(HashMap<String, String> hmCondition , int start_row , int end_row , int emp_no) throws BaseException , SQLException {
	System.out.println("관리자쪽 로우카운트");
	logger.info(hmCondition);
	
	con = getDataSource().getConnection();
	
	try {
		list = new ArrayList<HashMap<String,String>>();
		
		sql.setLength(0);
		
		sql.append("\r\n").append("			SELECT Z.*																																				");
		sql.append("\r\n").append("																																									");
		sql.append("\r\n").append("			FROM																																								");
		sql.append("\r\n").append("			(																																									");
		sql.append("\r\n").append("				SELECT  ROW_NUMBER() OVER( ORDER BY XX.YYYYMMDD DESC , XX.EMP_NO , XX.IN_OUT_TP , XX.GROUP_NO , XX.TEAM_NO ) ROWNUM,											");
		sql.append("\r\n").append("						CASE WHEN CHARINDEX('(' ,XX.GROUP_NM	) = 0 THEN XX.GROUP_NM ELSE SUBSTRING(XX.GROUP_NM , 1 , (CHARINDEX('(' ,XX.GROUP_NM	) - 1))	 END AS GROUP_NM			,		");
		sql.append("\r\n").append("						XX.GROUP_NM 	AS  GROUP_NM_TT			,																												");
		sql.append("\r\n").append("						XX.TEAM_NO				,																																");
		sql.append("\r\n").append("						XX.TEAM_NM				,																																");
		sql.append("\r\n").append("						XX.EMP_NO				,																																");
		sql.append("\r\n").append("						XX.EMP_NM				,																																");
		sql.append("\r\n").append("						XX.IN_OUT_DETAIL		,																																");
		sql.append("\r\n").append("						XX.IN_OUT_DETAIL_NM		,																																");
		sql.append("\r\n").append("						XX.IN_DETAIL			,																																");
		sql.append("\r\n").append("						XX.YYYYMMDD				,																																");
		sql.append("\r\n").append("						SUBSTRING(DATENAME(DW , CONVERT(SMALLDATETIME , XX.YYYYMMDD) ) ,1 ,1) AS  DAYNAME ,																		");
		sql.append("\r\n").append("						XX.IN_OUT_TP			,																																");
		sql.append("\r\n").append("						CASE WHEN XX.IN_OUT_TP = 'I' THEN  '출' ELSE '퇴' END IN_OUT_TP_NM 		,																				");
		sql.append("\r\n").append("						SUBSTRING(XX.IN_OUT_DT,5,8) AS IN_OUT_DT			,																									");
		sql.append("\r\n").append("						SUBSTRING(XX.IN_OUT_TIME,1,2) + ':' + SUBSTRING(XX.IN_OUT_TIME,3,4)	AS IN_OUT_TIME		,														    ");
		sql.append("\r\n").append("						XX.IN_OUT_PLACE			,																																");
		sql.append("\r\n").append("						C.CD_NM AS IN_OUT_PLACE_NM ,																															");
		sql.append("\r\n").append("						XX.ETC_EMP				,																																");
		sql.append("\r\n").append("						SUBSTRING(XX.ETC_EMP , 1 , 10) AS ETC_EMP_MEMO 	, 																										");
		sql.append("\r\n").append("						XX.ETC_MGR				,																																");
		sql.append("\r\n").append("						XX.REG_IP				,																																");
		sql.append("\r\n").append("						XX.MGR_CHANGE_YN		,																																");
		sql.append("\r\n").append("						XX.UPDATE_DT			,																																");
		sql.append("\r\n").append("						XX.APPROV_EMP_NO		,																																");
		sql.append("\r\n").append("						SUBSTRING(E.EMP_NM , 1, 3)	AS APPROV_EMP_NM		,																									");
		sql.append("\r\n").append("						E.EMP_NM 	AS APPROV_EMP_NM_TT		                ,																									");
		sql.append("\r\n").append("						XX.CONFIRM_YN			,																																");
		sql.append("\r\n").append("						XX.ADVANTAGE			,																																");
		sql.append("\r\n").append("						A_CD.ETC AS ADVANTAGE_NM,																																");
		sql.append("\r\n").append("                     XX.REQ_YN               ,                                                                                                                               ");
		sql.append("\r\n").append("                     CASE WHEN XX.REQ_YN = 'N' THEN  '요청중' WHEN XX.REQ_YN = 'Y' THEN  '완료' END IN_REQ_YN_NM ,                                                            ");
		sql.append("\r\n").append("						CASE WHEN (F.CLOSE_DT is null ) THEN 'N' ELSE 'Y' END  CLOSE_DT																							");
		sql.append("\r\n").append("				FROM																																							");
		sql.append("\r\n").append("				(																																								");
		sql.append("\r\n").append("						SELECT 																																					");
		sql.append("\r\n").append("								--ROW_NUMBER() OVER( ORDER BY IO.YYYYMMDD DESC , IO.EMP_NO , IO.IN_OUT_TP , VD.GROUP_NO , VD.TEAM_NO ) ROWNUM,									");
		sql.append("\r\n").append("								VD.GROUP_NO		,	VD.GROUP_NM,																												");
		sql.append("\r\n").append("								VD.TEAM_NO		,	VD.TEAM_NM,																													");
		sql.append("\r\n").append("								IO.EMP_NO		,	VD.EMP_NM,																													");
		sql.append("\r\n").append("								IO.IN_OUT_DETAIL,	IO.IN_OUT_DETAIL_NM,																										");
		sql.append("\r\n").append("								IO.IN_DETAIL	,																																");
		sql.append("\r\n").append("								IO.YYYYMMDD		,		IO.IN_OUT_TP,				--PK ROW																					");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.IN_OUT_DT,																																	");
		sql.append("\r\n").append("								IO.IN_OUT_TIME,																																	");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.IN_OUT_PLACE,																																");
		sql.append("\r\n").append("								IO.IN_OUT_PLACE_NM,																																");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.ETC_EMP,																																		");
		sql.append("\r\n").append("								IO.ETC_MGR,																																		");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.REG_IP,																																		");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.MGR_CHANGE_YN,																																");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.UPDATE_DT,																																	");
		sql.append("\r\n").append("								IO.APPROV_EMP_NO,																																");
		sql.append("\r\n").append("								IO.CONFIRM_YN,																																	");
		sql.append("\r\n").append("								IO.ADVANTAGE ,																																	");
		sql.append("\r\n").append("                             IO.REQ_YN                                                                                                                                       ");
		sql.append("\r\n").append("						FROM																																					");
		sql.append("\r\n").append("							(																																					");
		sql.append("\r\n").append("								SELECT  IO_CD.IN_OUT_DETAIL_NM ,																												");
		sql.append("\r\n").append("												IO_IN.*																															");
		sql.append("\r\n").append("								FROM 																																			");
		sql.append("\r\n").append("									(																																			");
		sql.append("\r\n").append("										--출퇴근유형																																");
		sql.append("\r\n").append("										SELECT A.YYYYMMDD , A.IN_OUT_TP , A.EMP_NO , A.IN_OUT_DETAIL, C.GROUP_CD, C.CD_NM AS IN_OUT_DETAIL_NM, C.ETC							");
		sql.append("\r\n").append("											FROM TB_ATTEND A, ( SELECT * FROM TB_COMM_CD WHERE ETC_CD IS NULL AND CD != '0' AND USE_YN = 'Y' ) C								");
		sql.append("\r\n").append("										WHERE A.IN_OUT_DETAIL = C.CD																											");
		sql.append("\r\n").append("									) IO_CD , 																																	");
		sql.append("\r\n").append("									(																																			");
		sql.append("\r\n").append("										--퇴근 ROW에 출근유형 추가																													");
		sql.append("\r\n").append("										SELECT 																																	");
		sql.append("\r\n").append("												AI.IN_OUT_DETAIL AS IN_DETAIL , A.*																								");
		sql.append("\r\n").append("										FROM 																																	");
		sql.append("\r\n").append("												TB_ATTEND A , 																													");
		sql.append("\r\n").append("												(SELECT YYYYMMDD , EMP_NO , IN_OUT_TP , IN_OUT_DETAIL  FROM TB_ATTEND WHERE IN_OUT_TP = 'I') AI									");
		sql.append("\r\n").append("										WHERE	--근태날짜와 사번만 조인																												");
		sql.append("\r\n").append("												A.YYYYMMDD = AI.YYYYMMDD 	--근태날짜																							");
		sql.append("\r\n").append("												AND 																																				");		
		sql.append("\r\n").append("												A.EMP_NO = AI.EMP_NO			--사번																												");
		sql.append("\r\n").append("												AND     A.YYYYMMDD   BETWEEN    REPLACE('"+hmCondition.get("s_date")+"' , '-' , '')  AND    REPLACE('"+hmCondition.get("e_date")+"' , '-' , '')		");
		sql.append("\r\n").append("									) IO_IN																																							");
		sql.append("\r\n").append("								WHERE	IO_CD.YYYYMMDD = IO_IN.YYYYMMDD																																");
		sql.append("\r\n").append("										AND																																							");
		sql.append("\r\n").append("										IO_CD.EMP_NO = IO_IN.EMP_NO																																	");
		sql.append("\r\n").append("										AND 																																						");
		sql.append("\r\n").append("										IO_CD.IN_OUT_TP = IO_IN.IN_OUT_TP																															");
		sql.append("\r\n").append("							) IO ,																																									");
		sql.append("\r\n").append("							V_DEPT	VD																																								");
		sql.append("\r\n").append("							WHERE IO.EMP_NO = VD.EMP_NO	AND 	VD.EMP_NO = 	"+emp_no+"																											");
		sql.append("\r\n").append("					) XX LEFT OUTER JOIN TB_COMM_CD 	C 		ON 	XX.IN_OUT_PLACE 	= 	C.CD 			--출퇴근지명칭 																			");
		sql.append("\r\n").append("					LEFT JOIN TB_COMM_CD 				A_CD 	ON 	XX.ADVANTAGE 		= 	A_CD.CD			--휴가반영 																				");
		sql.append("\r\n").append("					LEFT JOIN TB_EMP 					E 		ON 	XX.APPROV_EMP_NO 	= 	E.EMP_NO		--확인자 																					");
		sql.append("\r\n").append("					LEFT JOIN TB_ATTEND_CLOSE 			F 		ON  XX.YYYYMMDD 		=	F.CLOSE_DT		--마감여부 																				");
		sql.append("\r\n").append("					--     JOIN TB_AUTH_DEPT 				AZ 		ON 	XX.TEAM_NO 			= 	AZ.DEPT_NO 	 	AND 	AZ.EMP_NO =	"+emp_no+" 															");
		sql.append("\r\n").append("																																																	");
		sql.append("\r\n").append("					/*출근유형 AND 퇴근유형 START*/																																						");
		
		sql.append("\r\n").append("						 JOIN TB_ATTEND				IA		ON  XX.YYYYMMDD			=	IA.YYYYMMDD	AND XX.EMP_NO = IA.EMP_NO	AND IA.IN_OUT_TP = 'I'	");
		
		//결근이 선택되지 않았을 경우
	    if (hmCondition.get("req_change").equals("ALL")) {
	    	//출근상세
	    	//if (!hmCondition.get("chk_in_type").equals(CodeMetrix.ALL)) {
        		sql.append("\r\n").append("						 AND IA.REQ_YN IN ('Y','N')				");
        		//sql.append("\r\n").append("						 AND IA.IN_OUT_DETAIL != 'XX'				");
        		//sql.append("\r\n").append("						 AND XX.WORK_YN = 'Y'        		    ");
        	//}
	    }
	    if (hmCondition.get("req_change").equals("Y")){
	    	sql.append("\r\n").append("						 AND IA.REQ_YN = 'Y'				");    		    	
	    }
	    if (hmCondition.get("req_change").equals("N")){
	    	sql.append("\r\n").append("						 AND IA.REQ_YN = 'N'				"); 		    	
		    }
	  //사번이 ALL인 경우에 쿼리에서 제외한다.
		if (!hmCondition.get("semp_no").equals(CodeMetrix.ALL) &&  hmCondition.get("searchEmpNm").equals("")) {
			sql.append("\r\n").append("					  AND     XX.EMP_NO                    =   '"+hmCondition.get("semp_no")+"'                    																				");
		} else
		
		//사원검색일 경우 추가됨
		if ( (hmCondition.get("semp_no").equals(CodeMetrix.ALL) || hmCondition.get("semp_no").equals("")) &&  !hmCondition.get("searchEmpNm").equals("")) {
			sql.append("\r\n").append("					  AND     XX.EMP_NM                    LIKE    '"+hmCondition.get("searchEmpNm")+"%'                   																		");
		}
		
		sql.append("\r\n").append("					  /*조회조건 END*/																																						");
		sql.append("\r\n").append("					  AND	GROUP_NO 	LIKE	REPLACE('"+hmCondition.get("sgroup")+"' , 'ALL' , '%')		--	그룹			");
		sql.append("\r\n").append("					  AND 	TEAM_NO		LIKE	REPLACE('"+hmCondition.get("steam")+"' , 'ALL' , '%')		--	팀			");											
	    sql.append("\r\n").append("					  AND XX.IN_OUT_TP IN ('I','O')				");
	    
	    sql.append("\r\n").append("					  																																										");
		sql.append("\r\n").append("			) Z																																												");
		sql.append("\r\n").append("			WHERE 1=1	  AND	ROWNUM BETWEEN " + start_row + " AND " + end_row 			);
		
					
		logger.info("------------------------------근태관리-관리자-근태확인44444 LIST START---------------------------------");
		logger.info(sql);
		logger.info("------------------------------근태관리-관리자-근태확인44444 LIST END---------------------------------");
		
		pstmt 	= con.prepareStatement(sql.toString());
		
		/**************************************************************************/
		//P A R A M E T E R		V A L U E S		S T A R T
		/**************************************************************************/
		/**************************************************************************/
		//P A R A M E T E R		V A L U E S		E   N   D
		/**************************************************************************/
		
		rs		= pstmt.executeQuery();
		
		System.out.println("근태조회55555<<<<<<<<<<<<<<<<<<<");			
		System.out.println(sql.toString());
		System.out.println("근태조회55555>>>>>>>>>>>>>>>>>>>");
		
		while (rs.next()) {
			
			HashMap<String , String>  hash_map = new HashMap<String, String>();
			
			hash_map.put("대소문자로 구분하여 사용할 것." , "디비에서는 상관없음.");
			
			//jsp에서 <s:property value='upper_dept_no'/> 와 같아야 함.
			hash_map.put("rownum" 				, rs.getString("ROWNUM") );				//ROWNUM
			hash_map.put("group_nm" 			, rs.getString("GROUP_NM") );			//그룹
			hash_map.put("group_nm_tt" 			, rs.getString("GROUP_NM_TT") );			//그룹
			hash_map.put("team_nm"				, rs.getString("TEAM_NM") );			//팀
			hash_map.put("aemp_no"				, rs.getString("EMP_NO") );				//사번	//aemp_no
			hash_map.put("emp_nm"				, rs.getString("EMP_NM") );				//성명
			hash_map.put("yyyymmdd"				, rs.getString("YYYYMMDD") );			//기준일
			hash_map.put("dayname"				, rs.getString("DAYNAME") );			//요일
			hash_map.put("in_out_tp"			, rs.getString("IN_OUT_TP") );			//출근일짜
			hash_map.put("in_out_tp_nm"			, rs.getString("IN_OUT_TP_NM") );			//출근일짜
			hash_map.put("in_out_dt"			, rs.getString("IN_OUT_DT"));			//출근일짜
			hash_map.put("in_out_time"			, rs.getString("IN_OUT_TIME") );		//출근시간
			hash_map.put("reg_ip"				, rs.getString("REG_IP") );				//입력된 IP
			hash_map.put("in_detail"			, rs.getString("IN_DETAIL") );		//퇴근ROW의 출근태상세 code	//2009-03-31
			hash_map.put("in_out_detail"		, rs.getString("IN_OUT_DETAIL") );		//근태상세 code
			hash_map.put("in_out_detail_nm"		, rs.getString("IN_OUT_DETAIL_NM") );	//근태상세
			hash_map.put("in_out_place_nm"		, rs.getString("IN_OUT_PLACE_NM") );	//
			hash_map.put("in_req_yn_nm"		    , rs.getString("IN_REQ_YN_NM") );
			hash_map.put("etc_emp"				, rs.getString("ETC_EMP") );			//입력자 비고
			hash_map.put("etc_emp_memo"			, rs.getString("ETC_EMP_MEMO") );			//입력자 비고
			hash_map.put("update_dt"			, rs.getString("UPDATE_DT") );			//확인시간
			hash_map.put("etc_mgr"				, rs.getString("ETC_MGR") );			//확인자 비고
			hash_map.put("approv_emp_no"		, rs.getString("APPROV_EMP_NO") );		//확인자 사번
			hash_map.put("approv_emp_nm"		, rs.getString("APPROV_EMP_NM") );		//확인자 성명
			hash_map.put("approv_emp_nm_tt"		, rs.getString("APPROV_EMP_NM_TT") );		//확인자 성명
			hash_map.put("mgr_change_yn"		, rs.getString("MGR_CHANGE_YN") );		//확인자 유형상세 변경여부
     		hash_map.put("confirm_yn"		    , rs.getString("CONFIRM_YN") );       ////////
			hash_map.put("close_dt"				, rs.getString("CLOSE_DT") );		//확인자 유형상세 변경여부
			hash_map.put("advantage"			, rs.getString("ADVANTAGE") );		//
			hash_map.put("advantage_nm"			, rs.getString("ADVANTAGE_NM") );		//휴가
			hash_map.put("req_yn"               , rs.getString("REQ_YN"));              //요청처리여부
			
			list.add(hash_map);	// 한행의 데이터인 맵객체를 담는다.
			
		}
		
		if (hmCondition.get("confirm_yn").equals(CodeMetrix.NO) && list.size() == 0) {
			p_count	=	CodeMetrix.ZERO;
		} else {
			p_count =	list.size();
		}
		
	} catch (SQLException se) {
		se.printStackTrace();
		BaseException dex = new BaseException();                
		dex.setException(se);
		dex.setAppReturnCode("10");
		throw dex;
	} catch(Exception e) {
		BaseException dex = new BaseException();                
		dex.setException(e);
		dex.setAppReturnCode("20");
		throw dex;
	} finally {
		try {
			if (pstmt != null) pstmt.close();
			if (rs != null) rs.close();
			if(con != null) con.close();

		} catch(SQLException fse) {
			BaseException dex = new BaseException();                
			dex.setException(fse);
			dex.setAppReturnCode("10");
			throw dex;
		}
	}
}

public void retireveAttendLateList(HashMap<String, String> hmCondition , int start_row , int end_row , int emp_no, String e_date) throws BaseException , SQLException {

	logger.info(hmCondition);
	con = super.getDataSource().getConnection();
	
	
	try {
		list = new ArrayList<HashMap<String,String>>();
		
		sql.setLength(0);
		
		sql.append("\r\n").append("			SELECT Z.*																																							");
		sql.append("\r\n").append("			FROM																																								");
		sql.append("\r\n").append("			(																																									");
		sql.append("\r\n").append("				SELECT  ROW_NUMBER() OVER( ORDER BY XX.YYYYMMDD DESC , XX.EMP_NO , XX.IN_OUT_TP , XX.GROUP_NO , XX.TEAM_NO ) ROWNUM,											");
		sql.append("\r\n").append("						CASE WHEN CHARINDEX('(' ,XX.GROUP_NM	) = 0 THEN XX.GROUP_NM ELSE SUBSTRING(XX.GROUP_NM , 1 , (CHARINDEX('(' ,XX.GROUP_NM	) - 1))	 END AS GROUP_NM			,		");
		sql.append("\r\n").append("						XX.GROUP_NM 	AS  GROUP_NM_TT			,																												");
		sql.append("\r\n").append("						XX.TEAM_NO				,																																");
		sql.append("\r\n").append("						XX.TEAM_NM				,																																");
		sql.append("\r\n").append("						XX.EMP_NO				,																																");
		sql.append("\r\n").append("						XX.EMP_NM				,																																");
		//sql.append("\r\n").append("						XX.WORK_YN				,																																");//
		sql.append("\r\n").append("						XX.IN_OUT_DETAIL		,																																");
		sql.append("\r\n").append("						XX.IN_OUT_DETAIL_NM		,																																");
		sql.append("\r\n").append("						XX.IN_DETAIL			,																																");
		sql.append("\r\n").append("						XX.YYYYMMDD				,																																");
		sql.append("\r\n").append("						SUBSTRING(DATENAME(DW , CONVERT(SMALLDATETIME , XX.YYYYMMDD) ) ,1 ,1) AS  DAYNAME ,																		");
		sql.append("\r\n").append("						XX.IN_OUT_TP			,																																");
		sql.append("\r\n").append("						CASE WHEN XX.IN_OUT_TP = 'I' THEN  '출' ELSE '퇴' END IN_OUT_TP_NM 		,																				");
		sql.append("\r\n").append("						XX.IN_OUT_DT			,																																");
		sql.append("\r\n").append("						SUBSTRING(XX.IN_OUT_TIME,1,2) + ':' + SUBSTRING(XX.IN_OUT_TIME,3,4)	AS IN_OUT_TIME		,																");
		sql.append("\r\n").append("						XX.IN_OUT_PLACE			,																																");
		sql.append("\r\n").append("						C.CD_NM AS IN_OUT_PLACE_NM ,																															");
		sql.append("\r\n").append("						XX.ETC_EMP				,																																");
		sql.append("\r\n").append("						SUBSTRING(XX.ETC_EMP , 1 , 10) AS ETC_EMP_MEMO 	, 																										");
		sql.append("\r\n").append("						XX.ETC_MGR				,																																");
		sql.append("\r\n").append("						XX.REG_IP				,																																");
		sql.append("\r\n").append("						XX.MGR_CHANGE_YN		,																																");
		sql.append("\r\n").append("						XX.UPDATE_DT			,																																");
		sql.append("\r\n").append("						XX.APPROV_EMP_NO		,																																");
		sql.append("\r\n").append("						SUBSTRING(E.EMP_NM , 1, 3)	AS APPROV_EMP_NM		,																									");
		sql.append("\r\n").append("						E.EMP_NM 	AS APPROV_EMP_NM_TT		                ,																									");
		sql.append("\r\n").append("						XX.CONFIRM_YN			,																																");
		sql.append("\r\n").append("						XX.ADVANTAGE			,																																");
		sql.append("\r\n").append("						A_CD.ETC AS ADVANTAGE_NM,																																");
		
		//sql.append("\n").append(" 	DBO.FNC_GET_VACATION_WORK(XX.APPLY_DT,'"+e_date+"','VACA_S_DATE') AS VACA_S_DATE, ");
		//sql.append("\n").append(" 	DBO.FNC_GET_VACATION_WORK(XX.APPLY_DT,'"+e_date+"','VACA_E_DATE') AS VACA_E_DATE, ");
		
		sql.append("\n").append(" 	DBO.FNC_GET_VACATION_WORK(H.APPLY_DT,'"+e_date+"','VACA_S_DATE') AS VACA_S_DATE, ");
		sql.append("\n").append(" 	DBO.FNC_GET_VACATION_WORK(H.APPLY_DT,'"+e_date+"','VACA_E_DATE') AS VACA_E_DATE, ");


		sql.append("\r\n").append("						CASE WHEN (F.CLOSE_DT is null ) THEN 'N' ELSE 'Y' END  CLOSE_DT																							");
		sql.append("\r\n").append("				FROM																																							");
		sql.append("\r\n").append("				(																																								");
		sql.append("\r\n").append("						SELECT 																																					");
		sql.append("\r\n").append("								--ROW_NUMBER() OVER( ORDER BY IO.YYYYMMDD DESC , IO.EMP_NO , IO.IN_OUT_TP , VD.GROUP_NO , VD.TEAM_NO ) ROWNUM,									");
		sql.append("\r\n").append("								VD.GROUP_NO		,	VD.GROUP_NM,																												");
		sql.append("\r\n").append("								VD.TEAM_NO		,	VD.TEAM_NM,																													");
		sql.append("\r\n").append("								IO.EMP_NO		,	VD.EMP_NM,																													");
		sql.append("\r\n").append("								IO.IN_OUT_DETAIL,	IO.IN_OUT_DETAIL_NM,																										");
		sql.append("\r\n").append("								IO.IN_DETAIL	,																																");
		sql.append("\r\n").append("								IO.YYYYMMDD		,		IO.IN_OUT_TP,				--PK ROW																					");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.IN_OUT_DT,																																	");
		sql.append("\r\n").append("								IO.IN_OUT_TIME,																																	");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.IN_OUT_PLACE,																																");
		sql.append("\r\n").append("								IO.IN_OUT_PLACE_NM,																																");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.ETC_EMP,																																		");
		sql.append("\r\n").append("								IO.ETC_MGR,																																		");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.REG_IP,																																		");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.MGR_CHANGE_YN,																																");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.UPDATE_DT,																																	");
		sql.append("\r\n").append("								IO.APPROV_EMP_NO,																																");
		sql.append("\r\n").append("								IO.CONFIRM_YN,																																	");
		sql.append("\r\n").append("								IO.ADVANTAGE																																	");
		sql.append("\r\n").append("						FROM																																					");
		sql.append("\r\n").append("							(																																					");
		sql.append("\r\n").append("								SELECT  IO_CD.IN_OUT_DETAIL_NM ,																												");
		sql.append("\r\n").append("												IO_IN.*																															");
		sql.append("\r\n").append("								FROM 																																			");
		sql.append("\r\n").append("									(																																			");
		sql.append("\r\n").append("										--출퇴근유형																																");
		sql.append("\r\n").append("										SELECT A.YYYYMMDD , A.IN_OUT_TP , A.EMP_NO , A.IN_OUT_DETAIL, C.GROUP_CD, C.CD_NM AS IN_OUT_DETAIL_NM, C.ETC							");
		sql.append("\r\n").append("											FROM TB_ATTEND A, ( SELECT * FROM TB_COMM_CD WHERE ETC_CD IS NULL AND CD != '0' AND USE_YN = 'Y' ) C								");
		sql.append("\r\n").append("										WHERE A.IN_OUT_DETAIL = C.CD																											");
		sql.append("\r\n").append("									) IO_CD , 																																	");
		sql.append("\r\n").append("									(																																			");
		sql.append("\r\n").append("										--퇴근 ROW에 출근유형 추가																													");
		sql.append("\r\n").append("										SELECT 																																	");
		sql.append("\r\n").append("												AI.IN_OUT_DETAIL AS IN_DETAIL , A.*																								");
		sql.append("\r\n").append("										FROM 																																	");
		sql.append("\r\n").append("												TB_ATTEND A , 																													");
		sql.append("\r\n").append("												(SELECT YYYYMMDD , EMP_NO , IN_OUT_TP , IN_OUT_DETAIL  FROM TB_ATTEND WHERE IN_OUT_TP = 'I') AI									");
		sql.append("\r\n").append("										WHERE	--근태날짜와 사번만 조인																											");
		sql.append("\r\n").append("												A.YYYYMMDD = AI.YYYYMMDD 	--근태날짜																							");
		sql.append("\r\n").append("												AND 																															");		
		sql.append("\r\n").append("												A.EMP_NO = AI.EMP_NO			--사번																							");
		//sql.append("\r\n").append("												--AND     A.YYYYMMDD = REPLACE('"+hmCondition.get("e_date")+"' , '-' , '')		");
		//sql.append("\r\n").append("												--AND     A.YYYYMMDD = REPLACE('"+hmCondition.get("vaca_s_date")+"' , '-' , '')		");
		sql.append("\r\n").append("									) IO_IN																																		");
		sql.append("\r\n").append("								WHERE	IO_CD.YYYYMMDD = IO_IN.YYYYMMDD																											");
		sql.append("\r\n").append("										AND																																		");
		sql.append("\r\n").append("										IO_CD.EMP_NO = IO_IN.EMP_NO																														");
		sql.append("\r\n").append("										AND 																																						");
		sql.append("\r\n").append("										IO_CD.IN_OUT_TP = IO_IN.IN_OUT_TP																															");
		sql.append("\r\n").append("							) IO ,																																									");
		sql.append("\r\n").append("							V_DEPT	VD																																								");
		sql.append("\r\n").append("							WHERE IO.EMP_NO = VD.EMP_NO	AND 	VD.EMP_NO != 	"+emp_no+"																											");
		sql.append("\r\n").append("					) XX LEFT OUTER JOIN TB_COMM_CD 	C 		ON 	XX.IN_OUT_PLACE 	= 	C.CD 			--출퇴근지명칭 																			");
		sql.append("\r\n").append("					LEFT JOIN TB_COMM_CD 				A_CD 	ON 	XX.ADVANTAGE 		= 	A_CD.CD			--휴가반영 																				");
		
		sql.append("\r\n").append("					JOIN TB_EMP 					    H 		ON 	XX.EMP_NO 	        = 	H.EMP_NO		--확인자 																					");
		sql.append("\r\n").append("					LEFT JOIN TB_EMP 					E 		ON 	XX.APPROV_EMP_NO 	= 	E.EMP_NO		--확인자 																					");	
		sql.append("\r\n").append("					LEFT JOIN TB_ATTEND_CLOSE 			F 		ON  XX.YYYYMMDD 		=	F.CLOSE_DT		--마감여부 																				");
		sql.append("\r\n").append("					     JOIN TB_AUTH_DEPT 				AZ 		ON 	XX.TEAM_NO 			= 	AZ.DEPT_NO 	 	AND 	AZ.EMP_NO =	"+emp_no+" 															");
		sql.append("\r\n").append("																																																	");
		sql.append("\r\n").append("					/*출근유형 AND 퇴근유형 START*/																																						");
		
		sql.append("\r\n").append("						 JOIN TB_ATTEND				IA		ON  XX.YYYYMMDD			=	IA.YYYYMMDD	AND XX.EMP_NO = IA.EMP_NO	AND IA.IN_OUT_TP = 'I'	");
		
		//결근이 선택되지 않았을 경우
		//System.out.println("1>>>>>>>"+hmCondition.get("late_absence"));
	    if (hmCondition.get("late_absence").equals("ALL") ) {
	    	
	    	//출근상세
	    	//if (!hmCondition.get("chk_in_type").equals(CodeMetrix.ALL)) {
        		sql.append("\r\n").append("						 AND IA.IN_OUT_DETAIL IN ('0002','NN')				");
        		sql.append("\r\n").append("						 AND IA.IN_OUT_DETAIL != 'XX'				");
        		//sql.append("\r\n").append("						 AND XX.WORK_YN = 'Y' 			");
        	//}
	    	
	    }
	    if (hmCondition.get("late_absence").equals("NN")){
	    	sql.append("\r\n").append("						 AND IA.IN_OUT_DETAIL = 'NN'			");    		    	
	    }
	    if (hmCondition.get("late_absence").equals("0002")){
	    	sql.append("\r\n").append("						 AND IA.IN_OUT_DETAIL = '0002'				"); 		    	
		    }
	  //사번이 ALL인 경우에 쿼리에서 제외한다.
		if (!hmCondition.get("semp_no").equals(CodeMetrix.ALL) &&  hmCondition.get("searchEmpNm").equals("")) {
			sql.append("\r\n").append("					  AND     XX.EMP_NO                    =   '"+hmCondition.get("semp_no")+"'                    																				");
		} else
		
		//사원검색일 경우 추가됨
		if ( (hmCondition.get("semp_no").equals(CodeMetrix.ALL) || hmCondition.get("semp_no").equals("")) &&  !hmCondition.get("searchEmpNm").equals("")) {
			sql.append("\r\n").append("					  AND     XX.EMP_NM                    LIKE    '"+hmCondition.get("searchEmpNm")+"%'                   																		");
		}
		if(!hmCondition.get("e_date").equals("")){
	      
	       sql.append("\r\n").append("  AND  '"+e_date+"' >=  XX.YYYYMMDD      ");
	       sql.append("\r\n").append(" 	AND  DBO.FNC_GET_VACATION_WORK(H.APPLY_DT,'"+e_date+"','VACA_S_DATE') <= XX.YYYYMMDD           ");

		}
	    sql.append("\r\n").append("				AND IA.IN_OUT_TP = 'I'																					");
	    
		sql.append("\r\n").append("				WHERE 1	=	1																						");
		sql.append("\r\n").append("					  /*조회조건 START*/																						");
		sql.append("\r\n").append("					  AND	GROUP_NO 	LIKE	REPLACE('"+hmCondition.get("sgroup")+"' , 'ALL' , '%')		--	그룹			");
		sql.append("\r\n").append("					  AND 	TEAM_NO		LIKE	REPLACE('"+hmCondition.get("steam")+"' , 'ALL' , '%')		--	팀			");											
	    sql.append("\r\n").append("					  AND XX.IN_OUT_TP = 'I'				");
	    
																																				
		sql.append("\r\n").append("					  																																										");
		sql.append("\r\n").append("			) Z																																												");
		sql.append("\r\n").append("			WHERE 1=1	  AND	ROWNUM BETWEEN " + start_row + " AND " + end_row 			);
	    
		//if (!hmCondition.get("e_date").equals("")){
	    	//sql.append("\r\n").append("						 AND Z.YYYYMMDD >= Z.VACA_S_DATE				"); 
	    	//sql.append("\r\n").append("						 AND Z.YYYYMMDD <= Z.VACA_E_DATE				"); 
		   // }


		
//		System.out.println("======================================66666\r\n");
//		System.out.println("--근태관리-관리자-근태확인 LIST666666\r\n" + sql.toString());
//		System.out.println("======================================666666\r\n");
        
        logger.info("------------------------------근태관리-관리자-근태확인77777 LIST START---------------------------------");
        logger.info(sql);
        logger.info("------------------------------근태관리-관리자-근태확인77777 LIST END---------------------------------");
		
		pstmt 	= con.prepareStatement(sql.toString());
		
		/**************************************************************************/
		//P A R A M E T E R		V A L U E S		S T A R T
		/**************************************************************************/
		/**************************************************************************/
		//P A R A M E T E R		V A L U E S		E   N   D
		/**************************************************************************/
		
		rs		= pstmt.executeQuery();
		
		while (rs.next()) {
			
			HashMap<String , String>  hash_map = new HashMap<String, String>();
			
			hash_map.put("대소문자로 구분하여 사용할 것." , "디비에서는 상관없음.");
			
			//jsp에서 <s:property value='upper_dept_no'/> 와 같아야 함.
			hash_map.put("rownum" 				, rs.getString("ROWNUM") );				//ROWNUM
			hash_map.put("group_nm" 			, rs.getString("GROUP_NM") );			//그룹
			hash_map.put("group_nm_tt" 			, rs.getString("GROUP_NM_TT") );			//그룹
			hash_map.put("team_nm"				, rs.getString("TEAM_NM") );			//팀
			hash_map.put("aemp_no"				, rs.getString("EMP_NO") );				//사번	//aemp_no
			hash_map.put("emp_nm"				, rs.getString("EMP_NM") );				//성명
			hash_map.put("yyyymmdd"				, rs.getString("YYYYMMDD") );			//기준일
			hash_map.put("dayname"				, rs.getString("DAYNAME") );			//요일
			hash_map.put("in_out_tp"			, rs.getString("IN_OUT_TP") );			//출근일짜
			hash_map.put("in_out_tp_nm"			, rs.getString("IN_OUT_TP_NM") );			//출근일짜
			hash_map.put("in_out_dt"			, rs.getString("IN_OUT_DT") );			//출근일짜
			hash_map.put("in_out_time"			, rs.getString("IN_OUT_TIME") );		//출근시간
			hash_map.put("reg_ip"				, rs.getString("REG_IP") );				//입력된 IP
			hash_map.put("in_detail"			, rs.getString("IN_DETAIL") );		//퇴근ROW의 출근태상세 code	//2009-03-31
			hash_map.put("in_out_detail"		, rs.getString("IN_OUT_DETAIL") );		//근태상세 code
			hash_map.put("in_out_detail_nm"		, rs.getString("IN_OUT_DETAIL_NM") );	//근태상세
			hash_map.put("in_out_place_nm"		, rs.getString("IN_OUT_PLACE_NM") );	//
			hash_map.put("etc_emp"				, rs.getString("ETC_EMP") );			//입력자 비고
			hash_map.put("etc_emp_memo"			, rs.getString("ETC_EMP_MEMO") );			//입력자 비고
			hash_map.put("update_dt"			, rs.getString("UPDATE_DT") );			//확인시간
			hash_map.put("etc_mgr"				, rs.getString("ETC_MGR") );			//확인자 비고
			hash_map.put("approv_emp_no"		, rs.getString("APPROV_EMP_NO") );		//확인자 사번
			hash_map.put("approv_emp_nm"		, rs.getString("APPROV_EMP_NM") );		//확인자 성명
			hash_map.put("approv_emp_nm_tt"		, rs.getString("APPROV_EMP_NM_TT") );		//확인자 성명
			hash_map.put("mgr_change_yn"		, rs.getString("MGR_CHANGE_YN") );		//확인자 유형상세 변경여부
			hash_map.put("close_dt"				, rs.getString("CLOSE_DT") );		//확인자 유형상세 변경여부
			hash_map.put("advantage"			, rs.getString("ADVANTAGE") );		//
			hash_map.put("advantage_nm"			, rs.getString("ADVANTAGE_NM") );		//휴가
			hash_map.put("vaca_s_date"			, rs.getString("VACA_S_DATE") );		//
			hash_map.put("vaca_e_date"			, rs.getString("VACA_E_DATE") );		//휴가

			list.add(hash_map);	// 한행의 데이터인 맵객체를 담는다.
			
		}
		
		//if (hmCondition.get("confirm_yn").equals(CodeMetrix.NO) && list.size() == 0) {
		//	p_count	=	CodeMetrix.ZERO;
		//} else {
		//	p_count =	list.size();
		//}
					
	} catch (SQLException se) {
		se.printStackTrace();
		BaseException dex = new BaseException();                
		dex.setException(se);
		dex.setAppReturnCode("10");
		throw dex;
	} catch(Exception e) {
		BaseException dex = new BaseException();                
		dex.setException(e);
		dex.setAppReturnCode("20");
		throw dex;
	} finally {
		try {
			if (pstmt != null) pstmt.close();
			if (rs != null) rs.close();
			if(con != null) con.close();

		} catch(SQLException fse) {
			BaseException dex = new BaseException();                
			dex.setException(fse);
			dex.setAppReturnCode("10");
			throw dex;
		}
	}
}

public void retrieveAttendDetailLateRowCount(HashMap<String, String> hmCondition , int emp_no, String e_date) throws BaseException , SQLException {
	
	logger.info(hmCondition);
	
	con = getDataSource().getConnection();
	
	try {
		System.out.println("rowcount----------------------------->");
		sql	=	new StringBuffer();
		
		sql.setLength(0);
		
		sql.append("\r\n").append("			SELECT COUNT(*)	ROWCNT																																				");
		sql.append("\r\n").append("			FROM																																								");
		sql.append("\r\n").append("			(																																									");
		sql.append("\r\n").append("				SELECT  ROW_NUMBER() OVER( ORDER BY XX.YYYYMMDD DESC , XX.EMP_NO , XX.IN_OUT_TP , XX.GROUP_NO , XX.TEAM_NO ) ROWNUM,											");
		sql.append("\r\n").append("						XX.GROUP_NO				,																																");
		sql.append("\r\n").append("						CASE WHEN CHARINDEX('(' ,XX.GROUP_NM	) = 0 THEN XX.GROUP_NM ELSE SUBSTRING(XX.GROUP_NM , 1 , (CHARINDEX('(' ,XX.GROUP_NM	) - 1))	 END AS GROUP_NM			,		");
		sql.append("\r\n").append("						XX.GROUP_NM 	AS  GROUP_NM_TT			,																												");
		sql.append("\r\n").append("						XX.TEAM_NO				,																																");
		sql.append("\r\n").append("						XX.TEAM_NM				,																																");
		sql.append("\r\n").append("						XX.EMP_NO				,																																");
		sql.append("\r\n").append("						XX.EMP_NM				,																																");
		//sql.append("\r\n").append("						XX.WORK_YN				,																																");//
		sql.append("\r\n").append("						XX.IN_OUT_DETAIL		,																																");
		sql.append("\r\n").append("						XX.IN_OUT_DETAIL_NM		,																																");
		sql.append("\r\n").append("						XX.IN_DETAIL			,																																");
		sql.append("\r\n").append("						XX.YYYYMMDD				,																																");
		sql.append("\r\n").append("						SUBSTRING(DATENAME(DW , CONVERT(SMALLDATETIME , XX.YYYYMMDD) ) ,1 ,1) AS  DAYNAME ,																		");
		sql.append("\r\n").append("						XX.IN_OUT_TP			,																																");
		sql.append("\r\n").append("						CASE WHEN XX.IN_OUT_TP = 'I' THEN  '출' ELSE '퇴' END IN_OUT_TP_NM 		,																				");
		sql.append("\r\n").append("						XX.IN_OUT_DT			,																																");
		sql.append("\r\n").append("						SUBSTRING(XX.IN_OUT_TIME,1,2) + ':' + SUBSTRING(XX.IN_OUT_TIME,3,4)	AS IN_OUT_TIME		,																");
		sql.append("\r\n").append("						XX.IN_OUT_PLACE			,																																");
		sql.append("\r\n").append("						C.CD_NM AS IN_OUT_PLACE_NM ,																															");
		sql.append("\r\n").append("						XX.ETC_EMP				,																																");
		sql.append("\r\n").append("						SUBSTRING(XX.ETC_EMP , 1 , 10) AS ETC_EMP_MEMO 	, 																										");
		sql.append("\r\n").append("						XX.ETC_MGR				,																																");
		sql.append("\r\n").append("						XX.REG_IP				,																																");
		sql.append("\r\n").append("						XX.MGR_CHANGE_YN		,																																");
		sql.append("\r\n").append("						XX.UPDATE_DT			,																																");
		sql.append("\r\n").append("						XX.APPROV_EMP_NO		,																																");
		sql.append("\r\n").append("						SUBSTRING(E.EMP_NM , 1, 3)	AS APPROV_EMP_NM		,																									");
		sql.append("\r\n").append("						E.EMP_NM 	AS APPROV_EMP_NM_TT		                ,																									");
		sql.append("\r\n").append("						XX.CONFIRM_YN			,																																");
		sql.append("\r\n").append("						XX.ADVANTAGE			,																																");
		sql.append("\r\n").append("						A_CD.ETC AS ADVANTAGE_NM,																																");
		sql.append("\n").append(" 	DBO.FNC_GET_VACATION_WORK(E.APPLY_DT,'"+e_date+"','VACA_S_DATE') AS VACA_S_DATE,                                                                                            ");
		sql.append("\n").append(" 	DBO.FNC_GET_VACATION_WORK(E.APPLY_DT,'"+e_date+"','VACA_E_DATE') AS VACA_E_DATE,                                                                                            ");

		sql.append("\r\n").append("						CASE WHEN (F.CLOSE_DT is null ) THEN 'N' ELSE 'Y' END  CLOSE_DT																							");
		sql.append("\r\n").append("				FROM																																							");
		sql.append("\r\n").append("				(																																								");
		sql.append("\r\n").append("						SELECT 																																					");
		sql.append("\r\n").append("								--ROW_NUMBER() OVER( ORDER BY IO.YYYYMMDD DESC , IO.EMP_NO , IO.IN_OUT_TP , VD.GROUP_NO , VD.TEAM_NO ) ROWNUM,									");
		sql.append("\r\n").append("								VD.GROUP_NO		,	VD.GROUP_NM,																												");
		sql.append("\r\n").append("								VD.TEAM_NO		,	VD.TEAM_NM,																													");
		sql.append("\r\n").append("								IO.EMP_NO		,	VD.EMP_NM,																													");
		sql.append("\r\n").append("								IO.IN_OUT_DETAIL,	IO.IN_OUT_DETAIL_NM,																										");
		sql.append("\r\n").append("								IO.IN_DETAIL	,																																");
		sql.append("\r\n").append("								IO.YYYYMMDD		,		IO.IN_OUT_TP,				--PK ROW																					");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.IN_OUT_DT,																																	");
		sql.append("\r\n").append("								IO.IN_OUT_TIME,																																	");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.IN_OUT_PLACE,																																");
		sql.append("\r\n").append("								IO.IN_OUT_PLACE_NM,																																");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.ETC_EMP,																																		");
		sql.append("\r\n").append("								IO.ETC_MGR,																																		");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.REG_IP,																																		");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.MGR_CHANGE_YN,																																");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.UPDATE_DT,																																	");
		sql.append("\r\n").append("								IO.APPROV_EMP_NO,																																");
		sql.append("\r\n").append("								IO.CONFIRM_YN,																																	");
		sql.append("\r\n").append("								IO.ADVANTAGE																																	");
		sql.append("\r\n").append("						FROM																																					");
		sql.append("\r\n").append("							(																																					");
		sql.append("\r\n").append("								SELECT  IO_CD.IN_OUT_DETAIL_NM ,																												");
		sql.append("\r\n").append("												IO_IN.*																															");
		sql.append("\r\n").append("								FROM 																																			");
		sql.append("\r\n").append("									(																																			");
		sql.append("\r\n").append("										--출퇴근유형																																");
		sql.append("\r\n").append("										SELECT A.YYYYMMDD , A.IN_OUT_TP , A.EMP_NO , A.IN_OUT_DETAIL, C.GROUP_CD, C.CD_NM AS IN_OUT_DETAIL_NM, C.ETC							");
		sql.append("\r\n").append("											FROM TB_ATTEND A, ( SELECT * FROM TB_COMM_CD WHERE ETC_CD IS NULL AND CD != '0' AND USE_YN = 'Y' ) C								");
		sql.append("\r\n").append("										WHERE A.IN_OUT_DETAIL = C.CD																											");
		sql.append("\r\n").append("									) IO_CD , 																																	");
		sql.append("\r\n").append("									(																																			");
		sql.append("\r\n").append("										--퇴근 ROW에 출근유형 추가																													");
		sql.append("\r\n").append("										SELECT 																																	");
		sql.append("\r\n").append("												AI.IN_OUT_DETAIL AS IN_DETAIL , A.*																								");
		sql.append("\r\n").append("										FROM 																																	");
		sql.append("\r\n").append("												TB_ATTEND A , 																													");
		sql.append("\r\n").append("												(SELECT YYYYMMDD , EMP_NO , IN_OUT_TP , IN_OUT_DETAIL  FROM TB_ATTEND WHERE IN_OUT_TP = 'I') AI									");
		sql.append("\r\n").append("										WHERE	--근태날짜와 사번만 조인																												");
		sql.append("\r\n").append("												A.YYYYMMDD = AI.YYYYMMDD 	--근태날짜																							");
		sql.append("\r\n").append("												AND 																																				");		
		sql.append("\r\n").append("												A.EMP_NO = AI.EMP_NO			--사번																												");
		//sql.append("\r\n").append("												AND     A.YYYYMMDD   =   REPLACE('"+hmCondition.get("e_date")+"' , '-' , '')		                                            ");
		sql.append("\r\n").append("									) IO_IN																																							");
		sql.append("\r\n").append("								WHERE	IO_CD.YYYYMMDD = IO_IN.YYYYMMDD																																");
		sql.append("\r\n").append("										AND																																							");
		sql.append("\r\n").append("										IO_CD.EMP_NO = IO_IN.EMP_NO																																	");
		sql.append("\r\n").append("										AND 																																						");
		sql.append("\r\n").append("										IO_CD.IN_OUT_TP = IO_IN.IN_OUT_TP																															");
		sql.append("\r\n").append("							) IO ,																																									");
		sql.append("\r\n").append("							V_DEPT	VD																																								");
		sql.append("\r\n").append("							WHERE IO.EMP_NO = VD.EMP_NO	AND 	VD.EMP_NO =	"+emp_no+"																											");
		sql.append("\r\n").append("					) XX LEFT OUTER JOIN TB_COMM_CD 	C 		ON 	XX.IN_OUT_PLACE 	= 	C.CD 			--출퇴근지명칭 																			");
		sql.append("\r\n").append("					LEFT JOIN TB_COMM_CD 				A_CD 	ON 	XX.ADVANTAGE 		= 	A_CD.CD			--휴가반영 																				");
		//sql.append("\r\n").append("					LEFT JOIN TB_EMP 					E 		ON 	XX.APPROV_EMP_NO 	= 	E.EMP_NO		--확인자 																					");
		sql.append("\r\n").append("					LEFT JOIN TB_EMP 					E 		ON 	XX.EMP_NO 	= 	E.EMP_NO		--확인자                                                                                                                                                                                                                                            ");
		sql.append("\r\n").append("					LEFT JOIN TB_ATTEND_CLOSE 			F 		ON  XX.YYYYMMDD 		=	F.CLOSE_DT		--마감여부 																				");
		sql.append("\r\n").append("					     --JOIN TB_AUTH_DEPT 				AZ 		ON 	XX.TEAM_NO 			= 	AZ.DEPT_NO 	 	AND 	AZ.EMP_NO =	"+emp_no+" 															");
		
		sql.append("\r\n").append("					/*출근유형 AND 퇴근유형 START*/																																						");
		sql.append("\r\n").append("						 JOIN TB_ATTEND				IA		ON  XX.YYYYMMDD			=	IA.YYYYMMDD	AND XX.EMP_NO = IA.EMP_NO	AND IA.IN_OUT_TP = 'I'	");
		
		//결근이 선택되지 않았을 경우
	    if (hmCondition.get("late_absence").equals("ALL")) {
	    	//출근상세
	    	//if (!hmCondition.get("chk_in_type").equals(CodeMetrix.ALL)) {
        		sql.append("\r\n").append("						 AND IA.IN_OUT_DETAIL IN ('0002','NN')				");
        		sql.append("\r\n").append("						 AND IA.IN_OUT_DETAIL != 'XX'				");
        		//sql.append("\r\n").append("						 AND XX.WORK_YN = 'Y'        		    ");
        	//}
	    }
	    if (hmCondition.get("late_absence").equals("NN")){
	    	sql.append("\r\n").append("						 AND IA.IN_OUT_DETAIL = 'NN'				");    		    	
	    }
	    if (hmCondition.get("late_absence").equals("0002")){
	    	sql.append("\r\n").append("						 AND IA.IN_OUT_DETAIL = '0002'				"); 		    	
		    }
	  //사번이 ALL인 경우에 쿼리에서 제외한다.
		if (!hmCondition.get("semp_no").equals(CodeMetrix.ALL) &&  hmCondition.get("searchEmpNm").equals("")) {
			sql.append("\r\n").append("					  AND     XX.EMP_NO                    =   '"+hmCondition.get("semp_no")+"'                    																				");
		} else
		
		//사원검색일 경우 추가됨
		if ( (hmCondition.get("semp_no").equals(CodeMetrix.ALL) || hmCondition.get("semp_no").equals("")) &&  !hmCondition.get("searchEmpNm").equals("")) {
			sql.append("\r\n").append("					  AND     XX.EMP_NM                    LIKE    '"+hmCondition.get("searchEmpNm")+"%'                   																		");
		}
		if(!hmCondition.get("e_date").equals("")){
			sql.append("\r\n").append("  AND  '"+e_date+"' >=  XX.YYYYMMDD      ");
		    sql.append("\r\n").append(" 	AND  DBO.FNC_GET_VACATION_WORK(E.APPLY_DT,'"+e_date+"','VACA_S_DATE') <= XX.YYYYMMDD           ");
		}

		sql.append("\r\n").append("					  /*조회조건 END*/																																						");
		sql.append("\r\n").append("					  --AND	GROUP_NO 	LIKE	REPLACE('"+hmCondition.get("sgroup")+"' , 'ALL' , '%')		--	그룹			");
		sql.append("\r\n").append("					  --AND 	TEAM_NO		LIKE	REPLACE('"+hmCondition.get("steam")+"' , 'ALL' , '%')		--	팀			");
	    sql.append("\r\n").append("					  AND XX.IN_OUT_TP = 'I'				");
	    
		sql.append("\r\n").append("					  																																										");
		sql.append("\r\n").append("			) Z																																												");
        System.out.println("1111======================================22222\r\n");
		System.out.println("--근태관리-관리자-근태확인22222 1 ROW COUNT\r\n" + sql.toString());
		System.out.println("1111======================================22222\r\n");
		pstmt 	= con.prepareStatement(sql.toString());
	

		/**************************************************************************/
		//P A R A M E T E R		V A L U E S		S T A R T
		/**************************************************************************/
		/**************************************************************************/
		//P A R A M E T E R		V A L U E S		E   N   D
		/**************************************************************************/

		rs		= pstmt.executeQuery();

		if (rs.next()) {
			rowCount	=	Integer.valueOf(rs.getString("ROWCNT"));		//조건조회 결과
		}
		
	} catch (SQLException se) {
		se.printStackTrace();
		BaseException dex = new BaseException();                
		dex.setException(se);
		dex.setAppReturnCode("10");
		throw dex;
	} catch(Exception e) {
		BaseException dex = new BaseException();                
		dex.setException(e);
		dex.setAppReturnCode("20");
		throw dex;
	} finally {
		try {
			if (pstmt != null) pstmt.close();
			if (rs != null) rs.close();
			if(con != null) con.close();

		} catch(SQLException fse) {
			BaseException dex = new BaseException();                
			dex.setException(fse);
			dex.setAppReturnCode("10");
			throw dex;
		}
	}
}

public void retireveAttendDetailLateList(HashMap<String, String> hmCondition , int start_row , int end_row , int emp_no, String e_date) throws BaseException , SQLException {

	logger.info(hmCondition);
	con = super.getDataSource().getConnection();
	
	try {
		list = new ArrayList<HashMap<String,String>>();
		
		sql.setLength(0);
		
		sql.append("\r\n").append("			SELECT Z.*																																							");
		sql.append("\r\n").append("			FROM																																								");
		sql.append("\r\n").append("			(																																									");
		sql.append("\r\n").append("				SELECT  ROW_NUMBER() OVER( ORDER BY XX.YYYYMMDD DESC , XX.EMP_NO , XX.IN_OUT_TP , XX.GROUP_NO , XX.TEAM_NO ) ROWNUM,											");
		sql.append("\r\n").append("						CASE WHEN CHARINDEX('(' ,XX.GROUP_NM	) = 0 THEN XX.GROUP_NM ELSE SUBSTRING(XX.GROUP_NM , 1 , (CHARINDEX('(' ,XX.GROUP_NM	) - 1))	 END AS GROUP_NM			,		");
		sql.append("\r\n").append("						XX.GROUP_NM 	AS  GROUP_NM_TT			,																												");
		sql.append("\r\n").append("						XX.TEAM_NO				,																																");
		sql.append("\r\n").append("						XX.TEAM_NM				,																																");
		sql.append("\r\n").append("						XX.EMP_NO				,																																");
		sql.append("\r\n").append("						XX.EMP_NM				,																																");
		//sql.append("\r\n").append("						XX.WORK_YN				,																																");//
		sql.append("\r\n").append("						XX.IN_OUT_DETAIL		,																																");
		sql.append("\r\n").append("						XX.IN_OUT_DETAIL_NM		,																																");
		sql.append("\r\n").append("						XX.IN_DETAIL			,																																");
		sql.append("\r\n").append("						XX.YYYYMMDD				,																																");
		sql.append("\r\n").append("						SUBSTRING(DATENAME(DW , CONVERT(SMALLDATETIME , XX.YYYYMMDD) ) ,1 ,1) AS  DAYNAME ,																		");
		sql.append("\r\n").append("						XX.IN_OUT_TP			,																																");
		sql.append("\r\n").append("						CASE WHEN XX.IN_OUT_TP = 'I' THEN  '출' ELSE '퇴' END IN_OUT_TP_NM 		,																				");
		sql.append("\r\n").append("						XX.IN_OUT_DT			,																																");
		sql.append("\r\n").append("						SUBSTRING(XX.IN_OUT_TIME,1,2) + ':' + SUBSTRING(XX.IN_OUT_TIME,3,4)	AS IN_OUT_TIME		,																");
		sql.append("\r\n").append("						XX.IN_OUT_PLACE			,																																");
		sql.append("\r\n").append("						C.CD_NM AS IN_OUT_PLACE_NM ,																															");
		sql.append("\r\n").append("						XX.ETC_EMP				,																																");
		sql.append("\r\n").append("						SUBSTRING(XX.ETC_EMP , 1 , 10) AS ETC_EMP_MEMO 	, 																										");
		sql.append("\r\n").append("						XX.ETC_MGR				,																																");
		sql.append("\r\n").append("						XX.REG_IP				,																																");
		sql.append("\r\n").append("						XX.MGR_CHANGE_YN		,																																");
		sql.append("\r\n").append("						XX.UPDATE_DT			,																																");
		sql.append("\r\n").append("						XX.APPROV_EMP_NO		,																																");
		sql.append("\r\n").append("						SUBSTRING(E.EMP_NM , 1, 3)	AS APPROV_EMP_NM		,																									");
		sql.append("\r\n").append("						E.EMP_NM 	AS APPROV_EMP_NM_TT		                ,																									");
		sql.append("\r\n").append("						XX.CONFIRM_YN			,																																");
		sql.append("\r\n").append("						XX.ADVANTAGE			,																																");
		sql.append("\r\n").append("						A_CD.ETC AS ADVANTAGE_NM,																																");
		
		//sql.append("\n").append(" 	DBO.FNC_GET_VACATION_WORK(XX.APPLY_DT,'"+e_date+"','VACA_S_DATE') AS VACA_S_DATE, ");
		//sql.append("\n").append(" 	DBO.FNC_GET_VACATION_WORK(XX.APPLY_DT,'"+e_date+"','VACA_E_DATE') AS VACA_E_DATE, ");
		
		sql.append("\n").append(" 	DBO.FNC_GET_VACATION_WORK(H.APPLY_DT,'"+e_date+"','VACA_S_DATE') AS VACA_S_DATE, ");
		sql.append("\n").append(" 	DBO.FNC_GET_VACATION_WORK(H.APPLY_DT,'"+e_date+"','VACA_E_DATE') AS VACA_E_DATE, ");


		sql.append("\r\n").append("						CASE WHEN (F.CLOSE_DT is null ) THEN 'N' ELSE 'Y' END  CLOSE_DT																							");
		sql.append("\r\n").append("				FROM																																							");
		sql.append("\r\n").append("				(																																								");
		sql.append("\r\n").append("						SELECT 																																					");
		sql.append("\r\n").append("								--ROW_NUMBER() OVER( ORDER BY IO.YYYYMMDD DESC , IO.EMP_NO , IO.IN_OUT_TP , VD.GROUP_NO , VD.TEAM_NO ) ROWNUM,									");
		sql.append("\r\n").append("								VD.GROUP_NO		,	VD.GROUP_NM,																												");
		sql.append("\r\n").append("								VD.TEAM_NO		,	VD.TEAM_NM,																													");
		sql.append("\r\n").append("								IO.EMP_NO		,	VD.EMP_NM,																													");
		sql.append("\r\n").append("								IO.IN_OUT_DETAIL,	IO.IN_OUT_DETAIL_NM,																										");
		sql.append("\r\n").append("								IO.IN_DETAIL	,																																");
		sql.append("\r\n").append("								IO.YYYYMMDD		,		IO.IN_OUT_TP,				--PK ROW																					");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.IN_OUT_DT,																																	");
		sql.append("\r\n").append("								IO.IN_OUT_TIME,																																	");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.IN_OUT_PLACE,																																");
		sql.append("\r\n").append("								IO.IN_OUT_PLACE_NM,																																");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.ETC_EMP,																																		");
		sql.append("\r\n").append("								IO.ETC_MGR,																																		");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.REG_IP,																																		");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.MGR_CHANGE_YN,																																");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.UPDATE_DT,																																	");
		sql.append("\r\n").append("								IO.APPROV_EMP_NO,																																");
		sql.append("\r\n").append("								IO.CONFIRM_YN,																																	");
		sql.append("\r\n").append("								IO.ADVANTAGE																																	");
		sql.append("\r\n").append("						FROM																																					");
		sql.append("\r\n").append("							(																																					");
		sql.append("\r\n").append("								SELECT  IO_CD.IN_OUT_DETAIL_NM ,																												");
		sql.append("\r\n").append("												IO_IN.*																															");
		sql.append("\r\n").append("								FROM 																																			");
		sql.append("\r\n").append("									(																																			");
		sql.append("\r\n").append("										--출퇴근유형																																");
		sql.append("\r\n").append("										SELECT A.YYYYMMDD , A.IN_OUT_TP , A.EMP_NO , A.IN_OUT_DETAIL, C.GROUP_CD, C.CD_NM AS IN_OUT_DETAIL_NM, C.ETC							");
		sql.append("\r\n").append("											FROM TB_ATTEND A, ( SELECT * FROM TB_COMM_CD WHERE ETC_CD IS NULL AND CD != '0' AND USE_YN = 'Y' ) C								");
		sql.append("\r\n").append("										WHERE A.IN_OUT_DETAIL = C.CD																											");
		sql.append("\r\n").append("									) IO_CD , 																																	");
		sql.append("\r\n").append("									(																																			");
		sql.append("\r\n").append("										--퇴근 ROW에 출근유형 추가																													");
		sql.append("\r\n").append("										SELECT 																																	");
		sql.append("\r\n").append("												AI.IN_OUT_DETAIL AS IN_DETAIL , A.*																								");
		sql.append("\r\n").append("										FROM 																																	");
		sql.append("\r\n").append("												TB_ATTEND A , 																													");
		sql.append("\r\n").append("												(SELECT YYYYMMDD , EMP_NO , IN_OUT_TP , IN_OUT_DETAIL  FROM TB_ATTEND WHERE IN_OUT_TP = 'I') AI									");
		sql.append("\r\n").append("										WHERE	--근태날짜와 사번만 조인																											");
		sql.append("\r\n").append("												A.YYYYMMDD = AI.YYYYMMDD 	--근태날짜																							");
		sql.append("\r\n").append("												AND 																															");		
		sql.append("\r\n").append("												A.EMP_NO = AI.EMP_NO			--사번																							");
		//sql.append("\r\n").append("												--AND     A.YYYYMMDD = REPLACE('"+hmCondition.get("e_date")+"' , '-' , '')		");
		//sql.append("\r\n").append("												--AND     A.YYYYMMDD = REPLACE('"+hmCondition.get("vaca_s_date")+"' , '-' , '')		");
		sql.append("\r\n").append("									) IO_IN																																		");
		sql.append("\r\n").append("								WHERE	IO_CD.YYYYMMDD = IO_IN.YYYYMMDD																											");
		sql.append("\r\n").append("										AND																																		");
		sql.append("\r\n").append("										IO_CD.EMP_NO = IO_IN.EMP_NO																														");
		sql.append("\r\n").append("										AND 																																						");
		sql.append("\r\n").append("										IO_CD.IN_OUT_TP = IO_IN.IN_OUT_TP																															");
		sql.append("\r\n").append("							) IO ,																																									");
		sql.append("\r\n").append("							V_DEPT	VD																																								");
		sql.append("\r\n").append("							WHERE IO.EMP_NO = VD.EMP_NO	AND 	VD.EMP_NO = 	"+emp_no+"																											");
		sql.append("\r\n").append("					) XX LEFT OUTER JOIN TB_COMM_CD 	C 		ON 	XX.IN_OUT_PLACE 	= 	C.CD 			--출퇴근지명칭 																			");
		sql.append("\r\n").append("					LEFT JOIN TB_COMM_CD 				A_CD 	ON 	XX.ADVANTAGE 		= 	A_CD.CD			--휴가반영 																				");
		
		sql.append("\r\n").append("					JOIN TB_EMP 					    H 		ON 	XX.EMP_NO 	        = 	H.EMP_NO		--확인자 																					");
		sql.append("\r\n").append("					LEFT JOIN TB_EMP 					E 		ON 	XX.APPROV_EMP_NO 	= 	E.EMP_NO		--확인자 																					");	
		sql.append("\r\n").append("					LEFT JOIN TB_ATTEND_CLOSE 			F 		ON  XX.YYYYMMDD 		=	F.CLOSE_DT		--마감여부 																				");
		sql.append("\r\n").append("					     --JOIN TB_AUTH_DEPT 				AZ 		ON 	XX.TEAM_NO 			= 	AZ.DEPT_NO 	 	AND 	AZ.EMP_NO =	"+emp_no+" 															");
		sql.append("\r\n").append("																																																	");
		sql.append("\r\n").append("					/*출근유형 AND 퇴근유형 START*/																																						");
		
		sql.append("\r\n").append("						 JOIN TB_ATTEND				IA		ON  XX.YYYYMMDD			=	IA.YYYYMMDD	AND XX.EMP_NO = IA.EMP_NO	AND IA.IN_OUT_TP = 'I'	");
		
		//결근이 선택되지 않았을 경우
		//System.out.println("1>>>>>>>"+hmCondition.get("late_absence"));
	    if (hmCondition.get("late_absence").equals("ALL") ) {
	    	
	    	//출근상세
	    	//if (!hmCondition.get("chk_in_type").equals(CodeMetrix.ALL)) {
        		sql.append("\r\n").append("						 AND IA.IN_OUT_DETAIL IN ('0002','NN')				");
        		sql.append("\r\n").append("						 AND IA.IN_OUT_DETAIL != 'XX'				");
        		//sql.append("\r\n").append("						 AND XX.WORK_YN = 'Y' 			");
        	//}
	    	
	    }
	    if (hmCondition.get("late_absence").equals("NN")){
	    	sql.append("\r\n").append("						 AND IA.IN_OUT_DETAIL = 'NN'			");    		    	
	    }
	    if (hmCondition.get("late_absence").equals("0002")){
	    	sql.append("\r\n").append("						 AND IA.IN_OUT_DETAIL = '0002'				"); 		    	
		    }
	  //사번이 ALL인 경우에 쿼리에서 제외한다.
		if (!hmCondition.get("semp_no").equals(CodeMetrix.ALL) &&  hmCondition.get("searchEmpNm").equals("")) {
			sql.append("\r\n").append("					  AND     XX.EMP_NO                    =   '"+hmCondition.get("semp_no")+"'                    																				");
		} else
		
		//사원검색일 경우 추가됨
		if ( (hmCondition.get("semp_no").equals(CodeMetrix.ALL) || hmCondition.get("semp_no").equals("")) &&  !hmCondition.get("searchEmpNm").equals("")) {
			sql.append("\r\n").append("					  AND     XX.EMP_NM                    LIKE    '"+hmCondition.get("searchEmpNm")+"%'                   																		");
		}
		if(!hmCondition.get("e_date").equals("")){
	      
	       sql.append("\r\n").append("  AND  '"+e_date+"' >=  XX.YYYYMMDD      ");
	       sql.append("\r\n").append(" 	AND  DBO.FNC_GET_VACATION_WORK(H.APPLY_DT,'"+e_date+"','VACA_S_DATE') <= XX.YYYYMMDD           ");

		}
	    sql.append("\r\n").append("				AND IA.IN_OUT_TP = 'I'																					");
	    
		sql.append("\r\n").append("				WHERE 1	=	1																						");
		sql.append("\r\n").append("					  /*조회조건 START*/																						");
		sql.append("\r\n").append("					-- AND	GROUP_NO 	LIKE	REPLACE('"+hmCondition.get("sgroup")+"' , 'ALL' , '%')		--	그룹			");
		sql.append("\r\n").append("					-- AND 	TEAM_NO		LIKE	REPLACE('"+hmCondition.get("steam")+"' , 'ALL' , '%')		--	팀			");											
	    sql.append("\r\n").append("					  AND XX.IN_OUT_TP = 'I'				");
	    
																																				
		sql.append("\r\n").append("					  																																										");
		sql.append("\r\n").append("			) Z																																												");
		sql.append("\r\n").append("			WHERE 1=1	  AND	ROWNUM BETWEEN " + start_row + " AND " + end_row 			);
	    
		//if (!hmCondition.get("e_date").equals("")){
	    	//sql.append("\r\n").append("						 AND Z.YYYYMMDD >= Z.VACA_S_DATE				"); 
	    	//sql.append("\r\n").append("						 AND Z.YYYYMMDD <= Z.VACA_E_DATE				"); 
		   // }


		
//		System.out.println("======================================66666\r\n");
//		System.out.println("--근태관리-관리자-근태확인 LIST666666\r\n" + sql.toString());
//		System.out.println("======================================666666\r\n");
        
        logger.info("------------------------------근태관리-관리자-근태확인77777 LIST START---------------------------------");
        logger.info(sql);
        logger.info("------------------------------근태관리-관리자-근태확인77777 LIST END---------------------------------");
		
		pstmt 	= con.prepareStatement(sql.toString());
		
		/**************************************************************************/
		//P A R A M E T E R		V A L U E S		S T A R T
		/**************************************************************************/
		/**************************************************************************/
		//P A R A M E T E R		V A L U E S		E   N   D
		/**************************************************************************/
		
		rs		= pstmt.executeQuery();
		
		while (rs.next()) {
			
			HashMap<String , String>  hash_map = new HashMap<String, String>();
			
			hash_map.put("대소문자로 구분하여 사용할 것." , "디비에서는 상관없음.");
			
			//jsp에서 <s:property value='upper_dept_no'/> 와 같아야 함.
			hash_map.put("rownum" 				, rs.getString("ROWNUM") );				//ROWNUM
			hash_map.put("group_nm" 			, rs.getString("GROUP_NM") );			//그룹
			hash_map.put("group_nm_tt" 			, rs.getString("GROUP_NM_TT") );			//그룹
			hash_map.put("team_nm"				, rs.getString("TEAM_NM") );			//팀
			hash_map.put("aemp_no"				, rs.getString("EMP_NO") );				//사번	//aemp_no
			hash_map.put("emp_nm"				, rs.getString("EMP_NM") );				//성명
			hash_map.put("yyyymmdd"				, rs.getString("YYYYMMDD") );			//기준일
			hash_map.put("dayname"				, rs.getString("DAYNAME") );			//요일
			hash_map.put("in_out_tp"			, rs.getString("IN_OUT_TP") );			//출근일짜
			hash_map.put("in_out_tp_nm"			, rs.getString("IN_OUT_TP_NM") );			//출근일짜
			hash_map.put("in_out_dt"			, rs.getString("IN_OUT_DT") );			//출근일짜
			hash_map.put("in_out_time"			, rs.getString("IN_OUT_TIME") );		//출근시간
			hash_map.put("reg_ip"				, rs.getString("REG_IP") );				//입력된 IP
			hash_map.put("in_detail"			, rs.getString("IN_DETAIL") );		//퇴근ROW의 출근태상세 code	//2009-03-31
			hash_map.put("in_out_detail"		, rs.getString("IN_OUT_DETAIL") );		//근태상세 code
			hash_map.put("in_out_detail_nm"		, rs.getString("IN_OUT_DETAIL_NM") );	//근태상세
			hash_map.put("in_out_place_nm"		, rs.getString("IN_OUT_PLACE_NM") );	//
			hash_map.put("etc_emp"				, rs.getString("ETC_EMP") );			//입력자 비고
			hash_map.put("etc_emp_memo"			, rs.getString("ETC_EMP_MEMO") );			//입력자 비고
			hash_map.put("update_dt"			, rs.getString("UPDATE_DT") );			//확인시간
			hash_map.put("etc_mgr"				, rs.getString("ETC_MGR") );			//확인자 비고
			hash_map.put("approv_emp_no"		, rs.getString("APPROV_EMP_NO") );		//확인자 사번
			hash_map.put("approv_emp_nm"		, rs.getString("APPROV_EMP_NM") );		//확인자 성명
			hash_map.put("approv_emp_nm_tt"		, rs.getString("APPROV_EMP_NM_TT") );		//확인자 성명
			hash_map.put("mgr_change_yn"		, rs.getString("MGR_CHANGE_YN") );		//확인자 유형상세 변경여부
			hash_map.put("close_dt"				, rs.getString("CLOSE_DT") );		//확인자 유형상세 변경여부
			hash_map.put("advantage"			, rs.getString("ADVANTAGE") );		//
			hash_map.put("advantage_nm"			, rs.getString("ADVANTAGE_NM") );		//휴가
			hash_map.put("vaca_s_date"			, rs.getString("VACA_S_DATE") );		//
			hash_map.put("vaca_e_date"			, rs.getString("VACA_E_DATE") );		//휴가

			list.add(hash_map);	// 한행의 데이터인 맵객체를 담는다.
			
		}
		
		//if (hmCondition.get("confirm_yn").equals(CodeMetrix.NO) && list.size() == 0) {
		//	p_count	=	CodeMetrix.ZERO;
		//} else {
		//	p_count =	list.size();
		//}
					
	} catch (SQLException se) {
		se.printStackTrace();
		BaseException dex = new BaseException();                
		dex.setException(se);
		dex.setAppReturnCode("10");
		throw dex;
	} catch(Exception e) {
		BaseException dex = new BaseException();                
		dex.setException(e);
		dex.setAppReturnCode("20");
		throw dex;
	} finally {
		try {
			if (pstmt != null) pstmt.close();
			if (rs != null) rs.close();
			if(con != null) con.close();

		} catch(SQLException fse) {
			BaseException dex = new BaseException();                
			dex.setException(fse);
			dex.setAppReturnCode("10");
			throw dex;
		}
	}
}
	
	/**
	 * <pre>
	 * 출퇴근확인 Paging처리를 위해
	 * Row Count를 구한다.
	 * 조건들을 inline 하게 된다.
	 * </pre>
	 * @throws BaseException
	 * @throws SQLException
	 */
	public void retrieveAttendManagerRowCount(HashMap<String, String> hmCondition , int emp_no) throws BaseException , SQLException {
		
		logger.info(hmCondition);
		
		con = getDataSource().getConnection();
		
		try {

			sql	=	new StringBuffer();
			
			sql.setLength(0);
			
			sql.append("\r\n").append("			SELECT COUNT(*)	ROWCNT																																				");
			sql.append("\r\n").append("			FROM																																								");
			sql.append("\r\n").append("			(																																									");
			sql.append("\r\n").append("				SELECT  ROW_NUMBER() OVER( ORDER BY XX.YYYYMMDD DESC , XX.EMP_NO , XX.IN_OUT_TP , XX.GROUP_NO , XX.TEAM_NO ) ROWNUM,											");
			sql.append("\r\n").append("						XX.GROUP_NO				,																																");
			sql.append("\r\n").append("						CASE WHEN CHARINDEX('(' ,XX.GROUP_NM	) = 0 THEN XX.GROUP_NM ELSE SUBSTRING(XX.GROUP_NM , 1 , (CHARINDEX('(' ,XX.GROUP_NM	) - 1))	 END AS GROUP_NM			,		");
			sql.append("\r\n").append("						XX.GROUP_NM 	AS  GROUP_NM_TT			,																												");
			sql.append("\r\n").append("						XX.TEAM_NO				,																																");
			sql.append("\r\n").append("						XX.TEAM_NM				,																																");
			sql.append("\r\n").append("						XX.EMP_NO				,																																");
			sql.append("\r\n").append("						XX.EMP_NM				,																																");
			sql.append("\r\n").append("						XX.IN_OUT_DETAIL		,																																");
			sql.append("\r\n").append("						XX.IN_OUT_DETAIL_NM		,																																");
			sql.append("\r\n").append("						XX.IN_DETAIL			,																																");
			sql.append("\r\n").append("						XX.YYYYMMDD				,																																");
			sql.append("\r\n").append("						SUBSTRING(DATENAME(DW , CONVERT(SMALLDATETIME , XX.YYYYMMDD) ) ,1 ,1) AS  DAYNAME ,																		");
			sql.append("\r\n").append("						XX.IN_OUT_TP			,																																");
			sql.append("\r\n").append("						CASE WHEN XX.IN_OUT_TP = 'I' THEN  '출' ELSE '퇴' END IN_OUT_TP_NM 		,																				");
			sql.append("\r\n").append("						XX.IN_OUT_DT			,																																");
			sql.append("\r\n").append("						SUBSTRING(XX.IN_OUT_TIME,1,2) + ':' + SUBSTRING(XX.IN_OUT_TIME,3,4)	AS IN_OUT_TIME		,																");
			sql.append("\r\n").append("						XX.IN_OUT_PLACE			,																																");
			sql.append("\r\n").append("						C.CD_NM AS IN_OUT_PLACE_NM ,																															");
			sql.append("\r\n").append("						XX.ETC_EMP				,																																");
			sql.append("\r\n").append("						SUBSTRING(XX.ETC_EMP , 1 , 10) AS ETC_EMP_MEMO 	, 																										");
			sql.append("\r\n").append("						XX.ETC_MGR				,																																");
			sql.append("\r\n").append("						XX.REG_IP				,																																");
			sql.append("\r\n").append("						XX.MGR_CHANGE_YN		,																																");
			sql.append("\r\n").append("						XX.UPDATE_DT			,																																");
			sql.append("\r\n").append("						XX.APPROV_EMP_NO		,																																");
			sql.append("\r\n").append("						SUBSTRING(E.EMP_NM , 1, 3)	AS APPROV_EMP_NM		,																									");
			sql.append("\r\n").append("						E.EMP_NM 	AS APPROV_EMP_NM_TT		                ,																									");
			sql.append("\r\n").append("						XX.CONFIRM_YN			,																																");
			sql.append("\r\n").append("						XX.ADVANTAGE			,																																");
			sql.append("\r\n").append("						A_CD.ETC AS ADVANTAGE_NM,																																");
			sql.append("\r\n").append("						CASE WHEN (F.CLOSE_DT is null ) THEN 'N' ELSE 'Y' END  CLOSE_DT																							");
			sql.append("\r\n").append("				FROM																																							");
			sql.append("\r\n").append("				(																																								");
			sql.append("\r\n").append("						SELECT 																																					");
			sql.append("\r\n").append("								--ROW_NUMBER() OVER( ORDER BY IO.YYYYMMDD DESC , IO.EMP_NO , IO.IN_OUT_TP , VD.GROUP_NO , VD.TEAM_NO ) ROWNUM,									");
			sql.append("\r\n").append("								VD.GROUP_NO		,	VD.GROUP_NM,																												");
			sql.append("\r\n").append("								VD.TEAM_NO		,	VD.TEAM_NM,																													");
			sql.append("\r\n").append("								IO.EMP_NO		,	VD.EMP_NM,																													");
			sql.append("\r\n").append("								IO.IN_OUT_DETAIL,	IO.IN_OUT_DETAIL_NM,																										");
			sql.append("\r\n").append("								IO.IN_DETAIL	,																																");
			sql.append("\r\n").append("								IO.YYYYMMDD		,		IO.IN_OUT_TP,				--PK ROW																					");
			sql.append("\r\n").append("																																												");
			sql.append("\r\n").append("								IO.IN_OUT_DT,																																	");
			sql.append("\r\n").append("								IO.IN_OUT_TIME,																																	");
			sql.append("\r\n").append("																																												");
			sql.append("\r\n").append("								IO.IN_OUT_PLACE,																																");
			sql.append("\r\n").append("								IO.IN_OUT_PLACE_NM,																																");
			sql.append("\r\n").append("																																												");
			sql.append("\r\n").append("								IO.ETC_EMP,																																		");
			sql.append("\r\n").append("								IO.ETC_MGR,																																		");
			sql.append("\r\n").append("																																												");
			sql.append("\r\n").append("								IO.REG_IP,																																		");
			sql.append("\r\n").append("																																												");
			sql.append("\r\n").append("								IO.MGR_CHANGE_YN,																																");
			sql.append("\r\n").append("																																												");
			sql.append("\r\n").append("								IO.UPDATE_DT,																																	");
			sql.append("\r\n").append("								IO.APPROV_EMP_NO,																																");
			sql.append("\r\n").append("								IO.CONFIRM_YN,																																	");
			sql.append("\r\n").append("								IO.ADVANTAGE																																	");
			sql.append("\r\n").append("						FROM																																					");
			sql.append("\r\n").append("							(																																					");
			sql.append("\r\n").append("								SELECT  IO_CD.IN_OUT_DETAIL_NM ,																												");
			sql.append("\r\n").append("												IO_IN.*																															");
			sql.append("\r\n").append("								FROM 																																			");
			sql.append("\r\n").append("									(																																			");
			sql.append("\r\n").append("										--출퇴근유형																																");
			sql.append("\r\n").append("										SELECT A.YYYYMMDD , A.IN_OUT_TP , A.EMP_NO , A.IN_OUT_DETAIL, C.GROUP_CD, C.CD_NM AS IN_OUT_DETAIL_NM, C.ETC							");
			sql.append("\r\n").append("											FROM TB_ATTEND A, ( SELECT * FROM TB_COMM_CD WHERE ETC_CD IS NULL AND CD != '0' AND USE_YN = 'Y' ) C								");
			sql.append("\r\n").append("										WHERE A.IN_OUT_DETAIL = C.CD																											");
			sql.append("\r\n").append("									) IO_CD , 																																	");
			sql.append("\r\n").append("									(																																			");
			sql.append("\r\n").append("										--퇴근 ROW에 출근유형 추가																													");
			sql.append("\r\n").append("										SELECT 																																	");
			sql.append("\r\n").append("												AI.IN_OUT_DETAIL AS IN_DETAIL , A.*																								");
			sql.append("\r\n").append("										FROM 																																	");
			sql.append("\r\n").append("												TB_ATTEND A , 																													");
			sql.append("\r\n").append("												(SELECT YYYYMMDD , EMP_NO , IN_OUT_TP , IN_OUT_DETAIL  FROM TB_ATTEND WHERE IN_OUT_TP = 'I') AI									");
			sql.append("\r\n").append("										WHERE	--근태날짜와 사번만 조인																												");
			sql.append("\r\n").append("												A.YYYYMMDD = AI.YYYYMMDD 	--근태날짜																							");
			sql.append("\r\n").append("												AND 																																				");		
			sql.append("\r\n").append("												A.EMP_NO = AI.EMP_NO			--사번																												");
			sql.append("\r\n").append("												AND     A.YYYYMMDD   BETWEEN    REPLACE('"+hmCondition.get("s_date")+"' , '-' , '')  AND    REPLACE('"+hmCondition.get("e_date")+"' , '-' , '')		");
			sql.append("\r\n").append("									) IO_IN																																							");
			sql.append("\r\n").append("								WHERE	IO_CD.YYYYMMDD = IO_IN.YYYYMMDD																																");
			sql.append("\r\n").append("										AND																																							");
			sql.append("\r\n").append("										IO_CD.EMP_NO = IO_IN.EMP_NO																																	");
			sql.append("\r\n").append("										AND 																																						");
			sql.append("\r\n").append("										IO_CD.IN_OUT_TP = IO_IN.IN_OUT_TP																															");
			sql.append("\r\n").append("							) IO ,																																									");
			sql.append("\r\n").append("							V_DEPT	VD																																								");
			sql.append("\r\n").append("							WHERE IO.EMP_NO = VD.EMP_NO	AND 	VD.EMP_NO != 	"+emp_no+"																											");
			sql.append("\r\n").append("					) XX LEFT OUTER JOIN TB_COMM_CD 	C 		ON 	XX.IN_OUT_PLACE 	= 	C.CD 			--출퇴근지명칭 																			");
			sql.append("\r\n").append("					LEFT JOIN TB_COMM_CD 				A_CD 	ON 	XX.ADVANTAGE 		= 	A_CD.CD			--휴가반영 																				");
			sql.append("\r\n").append("					LEFT JOIN TB_EMP 					E 		ON 	XX.APPROV_EMP_NO 	= 	E.EMP_NO		--확인자 																					");
			sql.append("\r\n").append("					LEFT JOIN TB_ATTEND_CLOSE 			F 		ON  XX.YYYYMMDD 		=	F.CLOSE_DT		--마감여부 																				");
			sql.append("\r\n").append("					     JOIN TB_AUTH_DEPT 				AZ 		ON 	XX.TEAM_NO 			= 	AZ.DEPT_NO 	 	AND 	AZ.EMP_NO =	"+emp_no+" 															");
			
			sql.append("\r\n").append("					/*출근유형 AND 퇴근유형 START*/																																						");
			sql.append("\r\n").append("						 JOIN TB_ATTEND				IA		ON  XX.YYYYMMDD			=	IA.YYYYMMDD	AND XX.EMP_NO = IA.EMP_NO	AND IA.IN_OUT_TP = 'I'	");
			
			//결근이 선택되지 않았을 경우
		    if (!hmCondition.get("absence_type").equals(CodeMetrix.NN) ) {
		    	//출근상세
		    	if (!hmCondition.get("chk_in_type").equals(CodeMetrix.ALL)) {
	        		sql.append("\r\n").append("						 AND IA.IN_OUT_DETAIL = '"+hmCondition.get("chk_in_type")+"'				");
	        	}
		    }
		    
			sql.append("\r\n").append("						 JOIN TB_ATTEND				OA		ON  XX.YYYYMMDD			=   OA.YYYYMMDD AND XX.EMP_NO = OA.EMP_NO	AND OA.IN_OUT_TP = 'O'	");
			
			//결근이 선택되지 않았을 경우
		    if (!hmCondition.get("absence_type").equals(CodeMetrix.NN) ) {
		    	if (!hmCondition.get("chk_out_type").equals(CodeMetrix.ALL)) {
	        		sql.append("\r\n").append("						 AND OA.IN_OUT_DETAIL = '"+hmCondition.get("chk_out_type")+"'			");
		    	}
		    }
		  
			sql.append("\r\n").append("					/*출근유형 AND 퇴근유형 END*/																																						");
			sql.append("\r\n").append("																																																	");
			sql.append("\r\n").append("				WHERE 1	=	1																																										");
			sql.append("\r\n").append("					  /*조회조건 START*/																																								");
			sql.append("\r\n").append("					  AND	GROUP_NO 	LIKE	REPLACE('"+hmCondition.get("sgroup")+"' , 'ALL' , '%')		--	그룹																					");
			sql.append("\r\n").append("					  AND 	TEAM_NO		LIKE	REPLACE('"+hmCondition.get("steam")+"' , 'ALL' , '%')		--	팀																						");
			//sql.append("\r\n").append("					  AND 	XX.EMP_NO	LIKE	REPLACE('"+hmCondition.get("semp_no")+"' , 'ALL' , '%')																								");
			
			/**특근조회 S T A R T**/
		    if (hmCondition.get("sp_work_type").equals("SWO")) {
		    	
		    	if (hmCondition.get("sp_work_gubun").equals(CodeMetrix.ALL)) {
		    		
		    		sql.append("\r\n").append("					  AND (	IA.IN_OUT_DETAIL IN	(	'0006'	) 																");
		    		sql.append("\r\n").append("					  OR 	OA.IN_OUT_DETAIL IN	(	'1005'	,	'1008' 	) 		)											");
		    	} else if (hmCondition.get("sp_work_gubun").equals("1005")) {	//철야
		    		sql.append("\r\n").append("					  AND 	OA.IN_OUT_DETAIL =		'"+hmCondition.get("sp_work_gubun")+"' 					 				");
		    	} else if (hmCondition.get("sp_work_gubun").equals("0006")) {	//
					sql.append("\r\n").append("					  AND 	IA.IN_OUT_DETAIL =		'"+hmCondition.get("sp_work_gubun")+"' 					 				");
				}
		    	
		    } else if (hmCondition.get("sp_work_type").equals("SWX")) {
		    	sql.append("\r\n").append("					  AND (	IA.IN_OUT_DETAIL !=	'0006'	 																");
	    		sql.append("\r\n").append("					  AND 	OA.IN_OUT_DETAIL NOT	IN	(	'1005' ,	'1008' 	) 		)											");
		    }
		    /**특근조회 E   N   D**/
			
		    //추가 휴가반영 검색조건
		    if (hmCondition.get("addVacation").equals("AVO")) {
		    	if (hmCondition.get("addVacation_gubun").equals(CodeMetrix.ALL)) {
		    		sql.append("\r\n").append("						AND     OA.ADVANTAGE             IN   ( '3302' , '3303' )		--반일 + 일일휴가																			");
		    	} else {
		    		sql.append("\r\n").append("						AND     OA.ADVANTAGE             =   '"+hmCondition.get("addVacation_gubun")+"'						");
		    	}
		    } else	if (hmCondition.get("addVacation").equals("AVX")) {
		    	sql.append("\r\n").append("						AND    ( OA.ADVANTAGE             =    '3301' OR LEN(OA.ADVANTAGE) = 0 OR OA.ADVANTAGE = '' )		--반일 + 일일휴가											");
		    }	
		    
			//사번이 ALL인 경우에 쿼리에서 제외한다.
			if (!hmCondition.get("semp_no").equals(CodeMetrix.ALL) &&  hmCondition.get("searchEmpNm").equals("")) {
				sql.append("\r\n").append("					  AND     XX.EMP_NO                    =   '"+hmCondition.get("semp_no")+"'                    																				");
			} else
			
			//사원검색일 경우 추가됨
			if ( (hmCondition.get("semp_no").equals(CodeMetrix.ALL) || hmCondition.get("semp_no").equals("")) &&  !hmCondition.get("searchEmpNm").equals("")) {
				sql.append("\r\n").append("					  AND     XX.EMP_NM                    LIKE    '"+hmCondition.get("searchEmpNm")+"%'                   																		");
			}
			
			//확인여부가 ALL인경우 쿼리에서 제외시킴
			if (!hmCondition.get("confirm_yn").equals(CodeMetrix.ALL)) {
				sql.append("\r\n").append("					  AND     XX.CONFIRM_YN                =   '"+hmCondition.get("confirm_yn")+"' --확인여부																						");
			}
			
			//관리자 변경 여부가 ALL이 아닌경우 쿼리에서 제외시킴
			if (!hmCondition.get("mgr_change_yn").equals(CodeMetrix.ALL)) {
				sql.append("\r\n").append("					  AND     XX.MGR_CHANGE_YN             =   '" + hmCondition.get("mgr_change_yn") + "'  --CASE ? WHEN 'ALL' THEN '%' ELSE THEN ? END											");
			}
			

			sql.append("\r\n").append("					  AND   XX.IN_OUT_TP LIKE  	REPLACE('" + hmCondition.get("in_out_tp_condi") + "' , 'ALL' , '%')			--출퇴근분류 																");
			
			//결근
		    if (hmCondition.get("absence_type").equals(CodeMetrix.NN) ) {
//		    	sql.append("\r\n").append("				AND	  XX.IN_OUT_DETAIL = '"+hmCondition.get("absence_type")+"'   --결근																											");
		    	sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL LIKE	REPLACE('"+hmCondition.get("absence_type")+"' , 'ALL' , '%')	--출퇴근유형상세 																");
		    }
		    
		    /**휴가조회 START**/
			if(hmCondition.get("vacation_yn").equals("VCO")) {     //휴가여부가 휴가이면,,
							
				if (hmCondition.get("vacation_type").equals(CodeMetrix.ALL)) {  //모든 휴가
					sql.append("\r\n").append("	 AND 	XX.IN_OUT_DETAIL IN ( '0004' , '0005' , '0007' , '0008' , '0009' , '1006' , '1007' , '1009' , '1010' , '1011' , '2001' , '2002' , '2003' , '2004' , '2005'  ) 	");
					
				}else if (hmCondition.get("vacation_type").equals("VSO")) {		//연차관련
					
					if (hmCondition.get("vacation_gubun").equals(CodeMetrix.ALL)) { //모든 연차관련휴가(연차 + 특별)
						sql.append("\r\n").append("					  AND XX.IN_OUT_DETAIL  IN ( '0004' , '1006' , '2001' , '0007' , '1009' , '2002'  )	");
						
					} else if (hmCondition.get("vacation_gubun").equals("2001")) {	//연차						
						if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 연차휴가						
							sql.append("\r\n").append("			 AND 	XX.IN_OUT_DETAIL IN ( '0004' , '1006' , '2001' ) 	 ");
						}else if(hmCondition.get("vacation_detail").equals("HDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
							sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0004' AND OA.IN_OUT_DETAIL = '1006') OR (IA.IN_OUT_DETAIL = '2001' AND OA.IN_OUT_DETAIL = '2001')  ");
						}else if(hmCondition.get("vacation_detail").equals("HHD")) {   //반일휴가 
							if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
								sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0004' AND OA.IN_OUT_DETAIL != '1006' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0004' AND OA.IN_OUT_DETAIL = '1006' AND XX.IN_OUT_TP = 'O'))	");
							}else if(hmCondition.get("h_vacation_type").equals("0004")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0004'	AND OA.IN_OUT_DETAIL != '1006' AND XX.IN_OUT_TP = 'I' ");					
							}else if(hmCondition.get("h_vacation_type").equals("1006")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0004'	AND OA.IN_OUT_DETAIL = '1006' AND XX.IN_OUT_TP = 'O' ");								
							}
						}
						//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");

					} else if (hmCondition.get("vacation_gubun").equals("2002")) {	//특별
						if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 특별휴가						
							sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0007' , '1009' , '2002' ) 	 				");
						}else if(hmCondition.get("vacation_detail").equals("SDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
							sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0007' AND OA.IN_OUT_DETAIL = '1009') OR (IA.IN_OUT_DETAIL = '2002' AND OA.IN_OUT_DETAIL = '2002')  ");
						}else if(hmCondition.get("vacation_detail").equals("SHD")) {   //반일휴가 
							if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
								sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0007' AND OA.IN_OUT_DETAIL != '1009' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0007' AND OA.IN_OUT_DETAIL = '1009' AND XX.IN_OUT_TP = 'O'))	");
							}else if(hmCondition.get("h_vacation_type").equals("0004")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0007'	AND OA.IN_OUT_DETAIL != '1009' AND XX.IN_OUT_TP = 'I' ");				
							}else if(hmCondition.get("h_vacation_type").equals("1006")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0007'	AND OA.IN_OUT_DETAIL = '1009' AND XX.IN_OUT_TP = 'O' ");								
							}
						}
						//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
						
					} //else if (hmCondition.get("vacation_gubun").equals("HFV")) {	//반일연차
						//if (hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
						//	sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN		( '0004' , '1006' ) 	--// 													");
							
						//} else if (hmCondition.get("h_vacation_type").equals("0004")) {
						//	sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL =		'"+hmCondition.get("h_vacation_type")+"'  	--// 				");
						//} else if (hmCondition.get("h_vacation_type").equals("1006")) {
						//	sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL =		 '"+hmCondition.get("h_vacation_type")+"'  	--// 				");
						//}
						
					//}
				}else if (hmCondition.get("vacation_type").equals("VSX")) {		//연차외
					
					//if (hmCondition.get("vacation_gubun").equals("HFO")) {	//반일공가
						
					//	if (hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
					//		sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN		( '0005' , '1007' ) 	--// 									");
					//	} else {
					//		sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL =		'"+hmCondition.get("h_vacation_type")+"'  	--// 				");
					//	}
					//} 
					//else 
					if (hmCondition.get("vacation_gubun").equals(CodeMetrix.ALL)) {	// 모든 연차외 휴가(경조+공가+기타)
						sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0005' , '1007' , '2004' , '0008' , '1010' , '2003' , '0009' , '1011' , '2005'  )   			");
						//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
					} else if (hmCondition.get("vacation_gubun").equals("2003")) {	//경조
						if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 경조휴가						
							sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0008' , '1010' , '2003' ) 	 				");
						}else if(hmCondition.get("vacation_detail").equals("FDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
							sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0008' AND OA.IN_OUT_DETAIL = '1010') OR (IA.IN_OUT_DETAIL = '2003' AND OA.IN_OUT_DETAIL = '2003')  ");
						}else if(hmCondition.get("vacation_detail").equals("FHD")) {   //반일휴가 
							if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
								sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0008' AND OA.IN_OUT_DETAIL != '1010' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0008' AND OA.IN_OUT_DETAIL = '1010' AND XX.IN_OUT_TP = 'O'))	");
							}else if(hmCondition.get("h_vacation_type").equals("0004")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0008'	AND OA.IN_OUT_DETAIL != '1010' AND XX.IN_OUT_TP = 'I' ");				
							}else if(hmCondition.get("h_vacation_type").equals("1006")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0008'	AND OA.IN_OUT_DETAIL = '1010' AND XX.IN_OUT_TP = 'O' ");						
							}
						}
						
					
						//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
					} else if (hmCondition.get("vacation_gubun").equals("2004")) {	//공가
						if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 공가					
							sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0005' , '1007' , '2004' ) 	 				");
						}else if(hmCondition.get("vacation_detail").equals("GDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
							sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0005' AND OA.IN_OUT_DETAIL = '1007') OR (IA.IN_OUT_DETAIL = '2004' AND OA.IN_OUT_DETAIL = '2004')  ");
						}else if(hmCondition.get("vacation_detail").equals("GHD")) {   //반일휴가 
							if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
								sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0005' AND OA.IN_OUT_DETAIL != '1007' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0005' AND OA.IN_OUT_DETAIL = '1007' AND XX.IN_OUT_TP = 'O'))	");
							}else if(hmCondition.get("h_vacation_type").equals("0004")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0005'	AND OA.IN_OUT_DETAIL != '1007' AND XX.IN_OUT_TP = 'I' ");				
							}else if(hmCondition.get("h_vacation_type").equals("1006")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0005'	AND OA.IN_OUT_DETAIL = '1007' AND XX.IN_OUT_TP = 'O' ");	
							}							
						}
					
						//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
					} else if (hmCondition.get("vacation_gubun").equals("2005")) {	//기타
						if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 기타휴가						
							sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0009' , '1011' , '2005' ) 	 				");
						}else if(hmCondition.get("vacation_detail").equals("EDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
							sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0009' AND OA.IN_OUT_DETAIL = '1011') OR (IA.IN_OUT_DETAIL = '2005' AND OA.IN_OUT_DETAIL = '2005')  ");
						}else if(hmCondition.get("vacation_detail").equals("EHD")) {   //반일휴가 
							if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
								sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0009' AND OA.IN_OUT_DETAIL != '1011' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0009' AND OA.IN_OUT_DETAIL = '1011' AND XX.IN_OUT_TP = 'O'))	");
							}else if(hmCondition.get("h_vacation_type").equals("0004")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0009'	AND OA.IN_OUT_DETAIL != '1011' AND XX.IN_OUT_TP = 'I' ");					
							}else if(hmCondition.get("h_vacation_type").equals("1006")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0009'	AND OA.IN_OUT_DETAIL = '1011' AND XX.IN_OUT_TP = 'O' ");
							}							
						}
					}
						
						//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
				} else {
						//sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN		('0005' , '1007' , '2003' , '2004' , '2005'  )	--// 				");
						sql.append("\r\n").append("					  AND (XX.IN_OUT_DETAIL  IN ( '0005' , '1007' ) OR XX.IN_OUT_DETAIL IN ( '2003' , '2004' , '2005'  ) AND XX.IN_OUT_TP = 'O')		");
					}
					
			}

			if(hmCondition.get("vacation_yn").equals("VCX")) {     //휴가여부가 미휴가이면,,
				sql.append("\r\n").append("		AND 	XX.IN_OUT_DETAIL IN		( '0001' , '0002' , '0003'  , '0006' , '1001' , '1002' , '1003' , '1004' , '1005' , '1008' )   ");
			}
			
			/**휴가조회 END**/			//휴가유형			//else if (!hmCondition.get("vacation_type").equals(CodeMetrix.ALL)) {
		    //	sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL LIKE	REPLACE('"+hmCondition.get("vacation_type")+"' , 'ALL' , '%')	--출퇴근유형상세 														");
			//}
		    
			sql.append("\r\n").append("					  /*조회조건 END*/																																						");
			sql.append("\r\n").append("					  																																										");
			sql.append("\r\n").append("			) Z																																												");
			
	        System.out.println("======================================22222\r\n");
			System.out.println("--근태관리-관리자-근태확인22222 1 ROW COUNT\r\n" + sql.toString());
			System.out.println("======================================22222\r\n");

            logger.info("\n" + sql);
            
			pstmt 	= con.prepareStatement(sql.toString());

			/**************************************************************************/
			//P A R A M E T E R		V A L U E S		S T A R T
			/**************************************************************************/
			/**************************************************************************/
			//P A R A M E T E R		V A L U E S		E   N   D
			/**************************************************************************/

			rs		= pstmt.executeQuery();

			if (rs.next()) {
				rowCount	=	Integer.valueOf(rs.getString("ROWCNT"));		//조건조회 결과
			}
			
		} catch (SQLException se) {
			se.printStackTrace();
			BaseException dex = new BaseException();                
			dex.setException(se);
			dex.setAppReturnCode("10");
			throw dex;
		} catch(Exception e) {
			BaseException dex = new BaseException();                
			dex.setException(e);
			dex.setAppReturnCode("20");
			throw dex;
		} finally {
			try {
				if (pstmt != null) pstmt.close();
				if (rs != null) rs.close();
				if(con != null) con.close();

			} catch(SQLException fse) {
				BaseException dex = new BaseException();                
				dex.setException(fse);
				dex.setAppReturnCode("10");
				throw dex;
			}
		}
	}
	
public void retrieveAttendManagerRowCount_2(HashMap<String, String> hmCondition , int emp_no) throws BaseException , SQLException {
		
	logger.info(hmCondition);
	
	con = getDataSource().getConnection();
	
	try {
		
		sql	=	new StringBuffer();
		
		sql.setLength(0);
		
		sql.append("\r\n").append("			SELECT COUNT(*)	ROWCNT																																				");
		sql.append("\r\n").append("			FROM																																								");
		sql.append("\r\n").append("			(																																									");
		sql.append("\r\n").append("				SELECT  ROW_NUMBER() OVER( ORDER BY XX.YYYYMMDD DESC , XX.EMP_NO , XX.IN_OUT_TP , XX.GROUP_NO , XX.TEAM_NO ) ROWNUM,											");
		sql.append("\r\n").append("						XX.GROUP_NO				,																																");
		sql.append("\r\n").append("						CASE WHEN CHARINDEX('(' ,XX.GROUP_NM	) = 0 THEN XX.GROUP_NM ELSE SUBSTRING(XX.GROUP_NM , 1 , (CHARINDEX('(' ,XX.GROUP_NM	) - 1))	 END AS GROUP_NM			,		");
		sql.append("\r\n").append("						XX.GROUP_NM 	AS  GROUP_NM_TT			,																												");
		sql.append("\r\n").append("						XX.TEAM_NO				,																																");
		sql.append("\r\n").append("						XX.TEAM_NM				,																																");
		sql.append("\r\n").append("						XX.EMP_NO				,																																");
		sql.append("\r\n").append("						XX.EMP_NM				,																																");
		sql.append("\r\n").append("						XX.IN_OUT_DETAIL		,																																");
		sql.append("\r\n").append("						XX.IN_OUT_DETAIL_NM		,																																");
		sql.append("\r\n").append("						XX.IN_DETAIL			,																																");
		sql.append("\r\n").append("						XX.YYYYMMDD				,																																");
		sql.append("\r\n").append("						SUBSTRING(DATENAME(DW , CONVERT(SMALLDATETIME , XX.YYYYMMDD) ) ,1 ,1) AS  DAYNAME ,																		");
		sql.append("\r\n").append("						XX.IN_OUT_TP			,																																");
		sql.append("\r\n").append("						CASE WHEN XX.IN_OUT_TP = 'I' THEN  '출' ELSE '퇴' END IN_OUT_TP_NM 		,																				");
		sql.append("\r\n").append("						XX.IN_OUT_DT			,																																");
		sql.append("\r\n").append("						SUBSTRING(XX.IN_OUT_TIME,1,2) + ':' + SUBSTRING(XX.IN_OUT_TIME,3,4)	AS IN_OUT_TIME		,																");
		sql.append("\r\n").append("						XX.IN_OUT_PLACE			,																																");
		sql.append("\r\n").append("						C.CD_NM AS IN_OUT_PLACE_NM ,																															");
		sql.append("\r\n").append("						XX.ETC_EMP				,																																");
		sql.append("\r\n").append("						SUBSTRING(XX.ETC_EMP , 1 , 10) AS ETC_EMP_MEMO 	, 																										");
		sql.append("\r\n").append("						XX.ETC_MGR				,																																");
		sql.append("\r\n").append("						XX.REG_IP				,																																");
		sql.append("\r\n").append("						XX.MGR_CHANGE_YN		,																																");
		sql.append("\r\n").append("						XX.UPDATE_DT			,																																");
		sql.append("\r\n").append("						XX.APPROV_EMP_NO		,																																");
		sql.append("\r\n").append("						SUBSTRING(E.EMP_NM , 1, 3)	AS APPROV_EMP_NM		,																									");
		sql.append("\r\n").append("						E.EMP_NM 	AS APPROV_EMP_NM_TT		                ,																									");
		sql.append("\r\n").append("						XX.CONFIRM_YN			,																																");
		sql.append("\r\n").append("						XX.ADVANTAGE			,																																");
		sql.append("\r\n").append("						A_CD.ETC AS ADVANTAGE_NM,																																");
		sql.append("\r\n").append("						CASE WHEN (F.CLOSE_DT is null ) THEN 'N' ELSE 'Y' END  CLOSE_DT																							");
		sql.append("\r\n").append("				FROM																																							");
		sql.append("\r\n").append("				(																																								");
		sql.append("\r\n").append("						SELECT 																																					");
		sql.append("\r\n").append("								--ROW_NUMBER() OVER( ORDER BY IO.YYYYMMDD DESC , IO.EMP_NO , IO.IN_OUT_TP , VD.GROUP_NO , VD.TEAM_NO ) ROWNUM,									");
		sql.append("\r\n").append("								VD.GROUP_NO		,	VD.GROUP_NM,																												");
		sql.append("\r\n").append("								VD.TEAM_NO		,	VD.TEAM_NM,																													");
		sql.append("\r\n").append("								IO.EMP_NO		,	VD.EMP_NM,																													");
		sql.append("\r\n").append("								IO.IN_OUT_DETAIL,	IO.IN_OUT_DETAIL_NM,																										");
		sql.append("\r\n").append("								IO.IN_DETAIL	,																																");
		sql.append("\r\n").append("								IO.YYYYMMDD		,		IO.IN_OUT_TP,				--PK ROW																					");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.IN_OUT_DT,																																	");
		sql.append("\r\n").append("								IO.IN_OUT_TIME,																																	");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.IN_OUT_PLACE,																																");
		sql.append("\r\n").append("								IO.IN_OUT_PLACE_NM,																																");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.ETC_EMP,																																		");
		sql.append("\r\n").append("								IO.ETC_MGR,																																		");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.REG_IP,																																		");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.MGR_CHANGE_YN,																																");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.UPDATE_DT,																																	");
		sql.append("\r\n").append("								IO.APPROV_EMP_NO,																																");
		sql.append("\r\n").append("								IO.CONFIRM_YN,																																	");
		sql.append("\r\n").append("								IO.ADVANTAGE																																	");
		sql.append("\r\n").append("						FROM																																					");
		sql.append("\r\n").append("							(																																					");
		sql.append("\r\n").append("								SELECT  IO_CD.IN_OUT_DETAIL_NM ,																												");
		sql.append("\r\n").append("												IO_IN.*																															");
		sql.append("\r\n").append("								FROM 																																			");
		sql.append("\r\n").append("									(																																			");
		sql.append("\r\n").append("										--출퇴근유형																																");
		sql.append("\r\n").append("										SELECT A.YYYYMMDD , A.IN_OUT_TP , A.EMP_NO , A.IN_OUT_DETAIL, C.GROUP_CD, C.CD_NM AS IN_OUT_DETAIL_NM, C.ETC							");
		sql.append("\r\n").append("											FROM TB_ATTEND A, ( SELECT * FROM TB_COMM_CD WHERE ETC_CD IS NULL AND CD != '0' AND USE_YN = 'Y' ) C								");
		sql.append("\r\n").append("										WHERE A.IN_OUT_DETAIL = C.CD																											");
		sql.append("\r\n").append("									) IO_CD , 																																	");
		sql.append("\r\n").append("									(																																			");
		sql.append("\r\n").append("										--퇴근 ROW에 출근유형 추가																													");
		sql.append("\r\n").append("										SELECT 																																	");
		sql.append("\r\n").append("												AI.IN_OUT_DETAIL AS IN_DETAIL , A.*																								");
		sql.append("\r\n").append("										FROM 																																	");
		sql.append("\r\n").append("												TB_ATTEND A , 																													");
		sql.append("\r\n").append("												(SELECT YYYYMMDD , EMP_NO , IN_OUT_TP , IN_OUT_DETAIL  FROM TB_ATTEND WHERE IN_OUT_TP = 'I') AI									");
		sql.append("\r\n").append("										WHERE	--근태날짜와 사번만 조인																												");
		sql.append("\r\n").append("												A.YYYYMMDD = AI.YYYYMMDD 	--근태날짜																							");
		sql.append("\r\n").append("												AND 																																				");		
		sql.append("\r\n").append("												A.EMP_NO = AI.EMP_NO			--사번																												");
		sql.append("\r\n").append("												AND     A.YYYYMMDD   BETWEEN    REPLACE('"+hmCondition.get("s_date")+"' , '-' , '')  AND    REPLACE('"+hmCondition.get("e_date")+"' , '-' , '')		");
		sql.append("\r\n").append("									) IO_IN																																							");
		sql.append("\r\n").append("								WHERE	IO_CD.YYYYMMDD = IO_IN.YYYYMMDD																																");
		sql.append("\r\n").append("										AND																																							");
		sql.append("\r\n").append("										IO_CD.EMP_NO = IO_IN.EMP_NO																																	");
		sql.append("\r\n").append("										AND 																																						");
		sql.append("\r\n").append("										IO_CD.IN_OUT_TP = IO_IN.IN_OUT_TP																															");
		sql.append("\r\n").append("							) IO ,																																									");
		sql.append("\r\n").append("							V_DEPT	VD																																								");
		sql.append("\r\n").append("							WHERE IO.EMP_NO = VD.EMP_NO	AND 	VD.EMP_NO = 	"+emp_no+"																											");
		sql.append("\r\n").append("					) XX LEFT OUTER JOIN TB_COMM_CD 	C 		ON 	XX.IN_OUT_PLACE 	= 	C.CD 			--출퇴근지명칭 																			");
		sql.append("\r\n").append("					LEFT JOIN TB_COMM_CD 				A_CD 	ON 	XX.ADVANTAGE 		= 	A_CD.CD			--휴가반영 																				");
		sql.append("\r\n").append("					LEFT JOIN TB_EMP 					E 		ON 	XX.APPROV_EMP_NO 	= 	E.EMP_NO		--확인자 																					");
		sql.append("\r\n").append("					LEFT JOIN TB_ATTEND_CLOSE 			F 		ON  XX.YYYYMMDD 		=	F.CLOSE_DT		--마감여부 																				");
		sql.append("\r\n").append("					     --JOIN TB_AUTH_DEPT 				AZ 		ON 	XX.TEAM_NO 			= 	AZ.DEPT_NO 	 	AND 	AZ.EMP_NO =	"+emp_no+" 															");
		
		sql.append("\r\n").append("					/*출근유형 AND 퇴근유형 START*/																																						");
		sql.append("\r\n").append("						 JOIN TB_ATTEND				IA		ON  XX.YYYYMMDD			=	IA.YYYYMMDD	AND XX.EMP_NO = IA.EMP_NO	AND IA.IN_OUT_TP = 'I'	");
		
		//결근이 선택되지 않았을 경우
		if (!hmCondition.get("absence_type").equals(CodeMetrix.NN) ) {
			//출근상세
			if (!hmCondition.get("chk_in_type").equals(CodeMetrix.ALL)) {
				sql.append("\r\n").append("						 AND IA.IN_OUT_DETAIL = '"+hmCondition.get("chk_in_type")+"'				");
			}
		}
		
		sql.append("\r\n").append("						 JOIN TB_ATTEND				OA		ON  XX.YYYYMMDD			=   OA.YYYYMMDD AND XX.EMP_NO = OA.EMP_NO	AND OA.IN_OUT_TP = 'O'	");
		
		//결근이 선택되지 않았을 경우
		if (!hmCondition.get("absence_type").equals(CodeMetrix.NN) ) {
			if (!hmCondition.get("chk_out_type").equals(CodeMetrix.ALL)) {
				sql.append("\r\n").append("						 AND OA.IN_OUT_DETAIL = '"+hmCondition.get("chk_out_type")+"'			");
			}
		}
		
		sql.append("\r\n").append("					/*출근유형 AND 퇴근유형 END*/																																						");
		sql.append("\r\n").append("																																																	");
		sql.append("\r\n").append("				WHERE 1	=	1																																										");
		sql.append("\r\n").append("					  /*조회조건 START*/																																								");
		sql.append("\r\n").append("					  --AND	GROUP_NO 	LIKE	REPLACE('"+hmCondition.get("sgroup")+"' , 'ALL' , '%')		--	그룹																					");
		sql.append("\r\n").append("					  --AND 	TEAM_NO		LIKE	REPLACE('"+hmCondition.get("steam")+"' , 'ALL' , '%')		--	팀																						");
		//sql.append("\r\n").append("					  AND 	XX.EMP_NO	LIKE	REPLACE('"+hmCondition.get("semp_no")+"' , 'ALL' , '%')																								");
		
		/**특근조회 S T A R T**/
		if (hmCondition.get("sp_work_type").equals("SWO")) {
			
			if (hmCondition.get("sp_work_gubun").equals(CodeMetrix.ALL)) {
				
				sql.append("\r\n").append("					  AND (	IA.IN_OUT_DETAIL IN	(	'0006'	) 																");
				sql.append("\r\n").append("					  OR 	OA.IN_OUT_DETAIL IN	(	'1005'	,	'1008' 	) 		)											");
			} else if (hmCondition.get("sp_work_gubun").equals("1005")) {	//철야
				sql.append("\r\n").append("					  AND 	OA.IN_OUT_DETAIL =		'"+hmCondition.get("sp_work_gubun")+"' 					 				");
			} else if (hmCondition.get("sp_work_gubun").equals("0006")) {	//
				sql.append("\r\n").append("					  AND 	IA.IN_OUT_DETAIL =		'"+hmCondition.get("sp_work_gubun")+"' 					 				");
			}
			
		} else if (hmCondition.get("sp_work_type").equals("SWX")) {
			sql.append("\r\n").append("					  AND (	IA.IN_OUT_DETAIL !=	'0006'	 																");
			sql.append("\r\n").append("					  AND 	OA.IN_OUT_DETAIL NOT	IN	(	'1005' ,	'1008' 	) 		)											");
		}
		/**특근조회 E   N   D**/
		
		//추가 휴가반영 검색조건
		if (hmCondition.get("addVacation").equals("AVO")) {
			if (hmCondition.get("addVacation_gubun").equals(CodeMetrix.ALL)) {
				sql.append("\r\n").append("						AND     OA.ADVANTAGE             IN   ( '3302' , '3303' )		--반일 + 일일휴가																			");
			} else {
				sql.append("\r\n").append("						AND     OA.ADVANTAGE             =   '"+hmCondition.get("addVacation_gubun")+"'						");
			}
		} else	if (hmCondition.get("addVacation").equals("AVX")) {
			sql.append("\r\n").append("						AND    ( OA.ADVANTAGE             =    '3301' OR LEN(OA.ADVANTAGE) = 0 OR OA.ADVANTAGE = '' )		--반일 + 일일휴가											");
		}	
		
		//사번이 ALL인 경우에 쿼리에서 제외한다.
		if (!hmCondition.get("semp_no").equals(CodeMetrix.ALL) &&  hmCondition.get("searchEmpNm").equals("")) {
			sql.append("\r\n").append("					  --AND     XX.EMP_NO                    =   '"+hmCondition.get("semp_no")+"'                    																				");
		} else
			
			//사원검색일 경우 추가됨
			if ( (hmCondition.get("semp_no").equals(CodeMetrix.ALL) || hmCondition.get("semp_no").equals("")) &&  !hmCondition.get("searchEmpNm").equals("")) {
				sql.append("\r\n").append("					  --AND     XX.EMP_NM                    LIKE    '"+hmCondition.get("searchEmpNm")+"%'                   																		");
			}
		
		//확인여부가 ALL인경우 쿼리에서 제외시킴
		if (!hmCondition.get("confirm_yn").equals(CodeMetrix.ALL)) {
			sql.append("\r\n").append("					  AND     XX.CONFIRM_YN                =   '"+hmCondition.get("confirm_yn")+"' --확인여부																						");
		}
		
		//관리자 변경 여부가 ALL이 아닌경우 쿼리에서 제외시킴
		if (!hmCondition.get("mgr_change_yn").equals(CodeMetrix.ALL)) {
			sql.append("\r\n").append("					  AND     XX.MGR_CHANGE_YN             =   '" + hmCondition.get("mgr_change_yn") + "'  --CASE ? WHEN 'ALL' THEN '%' ELSE THEN ? END											");
		}
		
		
		sql.append("\r\n").append("					  AND   XX.IN_OUT_TP LIKE  	REPLACE('" + hmCondition.get("in_out_tp_condi") + "' , 'ALL' , '%')			--출퇴근분류 																");
		
		//결근
		if (hmCondition.get("absence_type").equals(CodeMetrix.NN) ) {
//	    	sql.append("\r\n").append("				AND	  XX.IN_OUT_DETAIL = '"+hmCondition.get("absence_type")+"'   --결근																											");
			sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL LIKE	REPLACE('"+hmCondition.get("absence_type")+"' , 'ALL' , '%')	--출퇴근유형상세 																");
		}
		
		/**휴가조회 START**/
		if(hmCondition.get("vacation_yn").equals("VCO")) {     //휴가여부가 휴가이면,,
						
			if (hmCondition.get("vacation_type").equals(CodeMetrix.ALL)) {  //모든 휴가
				sql.append("\r\n").append("	 AND 	XX.IN_OUT_DETAIL IN ( '0004' , '0005' , '0007' , '0008' , '0009' , '1006' , '1007' , '1009' , '1010' , '1011' , '2001' , '2002' , '2003' , '2004' , '2005'  ) 	");
				
			}else if (hmCondition.get("vacation_type").equals("VSO")) {		//연차관련
				
				if (hmCondition.get("vacation_gubun").equals(CodeMetrix.ALL)) { //모든 연차관련휴가(연차 + 특별)
					sql.append("\r\n").append("					  AND XX.IN_OUT_DETAIL  IN ( '0004' , '1006' , '2001' , '0007' , '1009' , '2002'  )	");
					
				} else if (hmCondition.get("vacation_gubun").equals("2001")) {	//연차						
					if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 연차휴가						
						sql.append("\r\n").append("			 AND 	XX.IN_OUT_DETAIL IN ( '0004' , '1006' , '2001' ) 	 ");
					}else if(hmCondition.get("vacation_detail").equals("HDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
						sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0004' AND OA.IN_OUT_DETAIL = '1006') OR (IA.IN_OUT_DETAIL = '2001' AND OA.IN_OUT_DETAIL = '2001')  ");
					}else if(hmCondition.get("vacation_detail").equals("HHD")) {   //반일휴가 
						if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
							sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0004' AND OA.IN_OUT_DETAIL != '1006' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0004' AND OA.IN_OUT_DETAIL = '1006' AND XX.IN_OUT_TP = 'O'))	");
						}else if(hmCondition.get("h_vacation_type").equals("0004")) {
							sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0004'	AND OA.IN_OUT_DETAIL != '1006' AND XX.IN_OUT_TP = 'I' ");					
						}else if(hmCondition.get("h_vacation_type").equals("1006")) {
							sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0004'	AND OA.IN_OUT_DETAIL = '1006' AND XX.IN_OUT_TP = 'O' ");								
						}
					}
					//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");

				} else if (hmCondition.get("vacation_gubun").equals("2002")) {	//특별
					if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 특별휴가						
						sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0007' , '1009' , '2002' ) 	 				");
					}else if(hmCondition.get("vacation_detail").equals("SDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
						sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0007' AND OA.IN_OUT_DETAIL = '1009') OR (IA.IN_OUT_DETAIL = '2002' AND OA.IN_OUT_DETAIL = '2002')  ");
					}else if(hmCondition.get("vacation_detail").equals("SHD")) {   //반일휴가 
						if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
							sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0007' AND OA.IN_OUT_DETAIL != '1009' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0007' AND OA.IN_OUT_DETAIL = '1009' AND XX.IN_OUT_TP = 'O'))	");
						}else if(hmCondition.get("h_vacation_type").equals("0004")) {
							sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0007'	AND OA.IN_OUT_DETAIL != '1009' AND XX.IN_OUT_TP = 'I' ");				
						}else if(hmCondition.get("h_vacation_type").equals("1006")) {
							sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0007'	AND OA.IN_OUT_DETAIL = '1009' AND XX.IN_OUT_TP = 'O' ");								
						}
					}
					//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
					
				} //else if (hmCondition.get("vacation_gubun").equals("HFV")) {	//반일연차
					//if (hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
					//	sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN		( '0004' , '1006' ) 	--// 													");
						
					//} else if (hmCondition.get("h_vacation_type").equals("0004")) {
					//	sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL =		'"+hmCondition.get("h_vacation_type")+"'  	--// 				");
					//} else if (hmCondition.get("h_vacation_type").equals("1006")) {
					//	sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL =		 '"+hmCondition.get("h_vacation_type")+"'  	--// 				");
					//}
					
				//}
			}else if (hmCondition.get("vacation_type").equals("VSX")) {		//연차외
				
				//if (hmCondition.get("vacation_gubun").equals("HFO")) {	//반일공가
					
				//	if (hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
				//		sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN		( '0005' , '1007' ) 	--// 									");
				//	} else {
				//		sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL =		'"+hmCondition.get("h_vacation_type")+"'  	--// 				");
				//	}
				//} 
				//else 
				if (hmCondition.get("vacation_gubun").equals(CodeMetrix.ALL)) {	// 모든 연차외 휴가(경조+공가+기타)
					sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0005' , '1007' , '2004' , '0008' , '1010' , '2003' , '0009' , '1011' , '2005'  )   			");
					//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
				} else if (hmCondition.get("vacation_gubun").equals("2003")) {	//경조
					if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 경조휴가						
						sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0008' , '1010' , '2003' ) 	 				");
					}else if(hmCondition.get("vacation_detail").equals("FDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
						sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0008' AND OA.IN_OUT_DETAIL = '1010') OR (IA.IN_OUT_DETAIL = '2003' AND OA.IN_OUT_DETAIL = '2003')  ");
					}else if(hmCondition.get("vacation_detail").equals("FHD")) {   //반일휴가 
						if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
							sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0008' AND OA.IN_OUT_DETAIL != '1010' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0008' AND OA.IN_OUT_DETAIL = '1010' AND XX.IN_OUT_TP = 'O'))	");
						}else if(hmCondition.get("h_vacation_type").equals("0004")) {
							sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0008'	AND OA.IN_OUT_DETAIL != '1010' AND XX.IN_OUT_TP = 'I' ");				
						}else if(hmCondition.get("h_vacation_type").equals("1006")) {
							sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0008'	AND OA.IN_OUT_DETAIL = '1010' AND XX.IN_OUT_TP = 'O' ");						
						}
					}
					
				
					//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
				} else if (hmCondition.get("vacation_gubun").equals("2004")) {	//공가
					if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 공가					
						sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0005' , '1007' , '2004' ) 	 				");
					}else if(hmCondition.get("vacation_detail").equals("GDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
						sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0005' AND OA.IN_OUT_DETAIL = '1007') OR (IA.IN_OUT_DETAIL = '2004' AND OA.IN_OUT_DETAIL = '2004')  ");
					}else if(hmCondition.get("vacation_detail").equals("GHD")) {   //반일휴가 
						if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
							sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0005' AND OA.IN_OUT_DETAIL != '1007' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0005' AND OA.IN_OUT_DETAIL = '1007' AND XX.IN_OUT_TP = 'O'))	");
						}else if(hmCondition.get("h_vacation_type").equals("0004")) {
							sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0005'	AND OA.IN_OUT_DETAIL != '1007' AND XX.IN_OUT_TP = 'I' ");				
						}else if(hmCondition.get("h_vacation_type").equals("1006")) {
							sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0005'	AND OA.IN_OUT_DETAIL = '1007' AND XX.IN_OUT_TP = 'O' ");	
						}							
					}
				
					//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
				} else if (hmCondition.get("vacation_gubun").equals("2005")) {	//기타
					if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 기타휴가						
						sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0009' , '1011' , '2005' ) 	 				");
					}else if(hmCondition.get("vacation_detail").equals("EDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
						sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0009' AND OA.IN_OUT_DETAIL = '1011') OR (IA.IN_OUT_DETAIL = '2005' AND OA.IN_OUT_DETAIL = '2005')  ");
					}else if(hmCondition.get("vacation_detail").equals("EHD")) {   //반일휴가 
						if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
							sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0009' AND OA.IN_OUT_DETAIL != '1011' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0009' AND OA.IN_OUT_DETAIL = '1011' AND XX.IN_OUT_TP = 'O'))	");
						}else if(hmCondition.get("h_vacation_type").equals("0004")) {
							sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0009'	AND OA.IN_OUT_DETAIL != '1011' AND XX.IN_OUT_TP = 'I' ");					
						}else if(hmCondition.get("h_vacation_type").equals("1006")) {
							sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0009'	AND OA.IN_OUT_DETAIL = '1011' AND XX.IN_OUT_TP = 'O' ");
						}							
					}
				}
					
					//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
			} else {
					//sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN		('0005' , '1007' , '2003' , '2004' , '2005'  )	--// 				");
					sql.append("\r\n").append("					  AND (XX.IN_OUT_DETAIL  IN ( '0005' , '1007' ) OR XX.IN_OUT_DETAIL IN ( '2003' , '2004' , '2005'  ) AND XX.IN_OUT_TP = 'O')		");
				}
				
		}

		if(hmCondition.get("vacation_yn").equals("VCX")) {     //휴가여부가 미휴가이면,,
			sql.append("\r\n").append("		AND 	XX.IN_OUT_DETAIL IN		( '0001' , '0002' , '0003'  , '0006' , '1001' , '1002' , '1003' , '1004' , '1005' , '1008' )   ");
		}
		
		/**휴가조회 END**/			//휴가유형			//else if (!hmCondition.get("vacation_type").equals(CodeMetrix.ALL)) {
			//sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL LIKE	REPLACE('"+hmCondition.get("vacation_type")+"' , 'ALL' , '%')	--출퇴근유형상세 														");
		//}
		
		sql.append("\r\n").append("					  /*조회조건 END*/																																						");
		sql.append("\r\n").append("					  																																										");
		sql.append("\r\n").append("			) Z																																												");
		
        System.out.println("======================================33333\r\n");
		System.out.println("--근태관리-관리자-근태확인33333 ROW COUNT\r\n" + sql.toString());
		System.out.println("======================================33333\r\n");
		
		logger.info("\n" + sql);
		
		pstmt 	= con.prepareStatement(sql.toString());
		
		/**************************************************************************/
		//P A R A M E T E R		V A L U E S		S T A R T
		/**************************************************************************/
		/**************************************************************************/
		//P A R A M E T E R		V A L U E S		E   N   D
		/**************************************************************************/
		
		rs		= pstmt.executeQuery();
		
		if (rs.next()) {
			rowCount	=	Integer.valueOf(rs.getString("ROWCNT"));		//조건조회 결과
		}
		
	} catch (SQLException se) {
		se.printStackTrace();
		BaseException dex = new BaseException();                
		dex.setException(se);
		dex.setAppReturnCode("10");
		throw dex;
	} catch(Exception e) {
		BaseException dex = new BaseException();                
		dex.setException(e);
		dex.setAppReturnCode("20");
		throw dex;
	} finally {
		try {
			if (pstmt != null) pstmt.close();
			if (rs != null) rs.close();
			if(con != null) con.close();
			
		} catch(SQLException fse) {
			BaseException dex = new BaseException();                
			dex.setException(fse);
			dex.setAppReturnCode("10");
			throw dex;
		}
	}
}
	/**
	 * <pre>
	 * 근태관리-출퇴근확인-관리자- 결과 조회
	 * </pre>
	 * @throws BaseException
	 * @throws SQLException
	 */
	public void retireveAttendDetailList(HashMap<String, String> hmCondition , int start_row , int end_row , int emp_no) throws BaseException , SQLException {
		
		System.out.println("안녕~~~~~~~~~~~~~~~~~~~~~~~");
		
		logger.info(hmCondition);
		con = super.getDataSource().getConnection();
		
		try {
			list = new ArrayList<HashMap<String,String>>();
			
			sql.setLength(0);
			
			sql.append("\r\n").append("			SELECT Z.*																																							");
			sql.append("\r\n").append("			FROM																																								");
			sql.append("\r\n").append("			(																																									");
			sql.append("\r\n").append("				SELECT  ROW_NUMBER() OVER( ORDER BY XX.YYYYMMDD DESC , XX.EMP_NO , XX.IN_OUT_TP , XX.GROUP_NO , XX.TEAM_NO ) ROWNUM,											");
			sql.append("\r\n").append("						CASE WHEN CHARINDEX('(' ,XX.GROUP_NM	) = 0 THEN XX.GROUP_NM ELSE SUBSTRING(XX.GROUP_NM , 1 , (CHARINDEX('(' ,XX.GROUP_NM	) - 1))	 END AS GROUP_NM			,		");
			sql.append("\r\n").append("						XX.GROUP_NM 	AS  GROUP_NM_TT			,																												");
			sql.append("\r\n").append("						XX.TEAM_NO				,																																");
			sql.append("\r\n").append("						XX.TEAM_NM				,																																");
			sql.append("\r\n").append("						XX.EMP_NO				,																																");
			sql.append("\r\n").append("						XX.EMP_NM				,																																");
			sql.append("\r\n").append("						XX.IN_OUT_DETAIL		,																																");
			sql.append("\r\n").append("						XX.IN_OUT_DETAIL_NM		,																																");
			sql.append("\r\n").append("						XX.IN_DETAIL			,																																");
			sql.append("\r\n").append("						XX.YYYYMMDD				,																																");
			sql.append("\r\n").append("						SUBSTRING(DATENAME(DW , CONVERT(SMALLDATETIME , XX.YYYYMMDD) ) ,1 ,1) AS  DAYNAME ,																		");
			sql.append("\r\n").append("						XX.IN_OUT_TP			,																																");
			sql.append("\r\n").append("						CASE WHEN XX.IN_OUT_TP = 'I' THEN  '출' ELSE '퇴' END IN_OUT_TP_NM 		,																				");
			sql.append("\r\n").append("						XX.IN_OUT_DT			,																																");
			sql.append("\r\n").append("						SUBSTRING(XX.IN_OUT_TIME,1,2) + ':' + SUBSTRING(XX.IN_OUT_TIME,3,4)	AS IN_OUT_TIME		,																");
			sql.append("\r\n").append("						XX.IN_OUT_PLACE			,																																");
			sql.append("\r\n").append("						C.CD_NM AS IN_OUT_PLACE_NM ,																															");
			sql.append("\r\n").append("						XX.ETC_EMP				,																																");
			sql.append("\r\n").append("						SUBSTRING(XX.ETC_EMP , 1 , 10) AS ETC_EMP_MEMO 	, 																										");
			sql.append("\r\n").append("						XX.ETC_MGR				,																																");
			sql.append("\r\n").append("						XX.REG_IP				,																																");
			sql.append("\r\n").append("						XX.MGR_CHANGE_YN		,																																");
			sql.append("\r\n").append("						XX.UPDATE_DT			,																																");
			sql.append("\r\n").append("						XX.APPROV_EMP_NO		,																																");
			sql.append("\r\n").append("						SUBSTRING(E.EMP_NM , 1, 3)	AS APPROV_EMP_NM		,																									");
			sql.append("\r\n").append("						E.EMP_NM 	AS APPROV_EMP_NM_TT		                ,																									");
			sql.append("\r\n").append("						XX.CONFIRM_YN			,																																");
			sql.append("\r\n").append("						XX.ADVANTAGE			,																																");
			sql.append("\r\n").append("						A_CD.ETC AS ADVANTAGE_NM,																																");
			sql.append("\r\n").append("						CASE WHEN (F.CLOSE_DT is null ) THEN 'N' ELSE 'Y' END  CLOSE_DT																							");
			sql.append("\r\n").append("				FROM																																							");
			sql.append("\r\n").append("				(																																								");
			sql.append("\r\n").append("						SELECT 																																					");
			sql.append("\r\n").append("								--ROW_NUMBER() OVER( ORDER BY IO.YYYYMMDD DESC , IO.EMP_NO , IO.IN_OUT_TP , VD.GROUP_NO , VD.TEAM_NO ) ROWNUM,									");
			sql.append("\r\n").append("								VD.GROUP_NO		,	VD.GROUP_NM,																												");
			sql.append("\r\n").append("								VD.TEAM_NO		,	VD.TEAM_NM,																													");
			sql.append("\r\n").append("								IO.EMP_NO		,	VD.EMP_NM,																													");
			sql.append("\r\n").append("								IO.IN_OUT_DETAIL,	IO.IN_OUT_DETAIL_NM,																										");
			sql.append("\r\n").append("								IO.IN_DETAIL	,																																");
			sql.append("\r\n").append("								IO.YYYYMMDD		,		IO.IN_OUT_TP,				--PK ROW																					");
			sql.append("\r\n").append("																																												");
			sql.append("\r\n").append("								IO.IN_OUT_DT,																																	");
			sql.append("\r\n").append("								IO.IN_OUT_TIME,																																	");
			sql.append("\r\n").append("																																												");
			sql.append("\r\n").append("								IO.IN_OUT_PLACE,																																");
			sql.append("\r\n").append("								IO.IN_OUT_PLACE_NM,																																");
			sql.append("\r\n").append("																																												");
			sql.append("\r\n").append("								IO.ETC_EMP,																																		");
			sql.append("\r\n").append("								IO.ETC_MGR,																																		");
			sql.append("\r\n").append("																																												");
			sql.append("\r\n").append("								IO.REG_IP,																																		");
			sql.append("\r\n").append("																																												");
			sql.append("\r\n").append("								IO.MGR_CHANGE_YN,																																");
			sql.append("\r\n").append("																																												");
			sql.append("\r\n").append("								IO.UPDATE_DT,																																	");
			sql.append("\r\n").append("								IO.APPROV_EMP_NO,																																");
			sql.append("\r\n").append("								IO.CONFIRM_YN,																																	");
			sql.append("\r\n").append("								IO.ADVANTAGE																																	");
			sql.append("\r\n").append("						FROM																																					");
			sql.append("\r\n").append("							(																																					");
			sql.append("\r\n").append("								SELECT  IO_CD.IN_OUT_DETAIL_NM ,																												");
			sql.append("\r\n").append("												IO_IN.*																															");
			sql.append("\r\n").append("								FROM 																																			");
			sql.append("\r\n").append("									(																																			");
			sql.append("\r\n").append("										--출퇴근유형																																");
			sql.append("\r\n").append("										SELECT A.YYYYMMDD , A.IN_OUT_TP , A.EMP_NO , A.IN_OUT_DETAIL, C.GROUP_CD, C.CD_NM AS IN_OUT_DETAIL_NM, C.ETC							");
			sql.append("\r\n").append("											FROM TB_ATTEND A, ( SELECT * FROM TB_COMM_CD WHERE ETC_CD IS NULL AND CD != '0' AND USE_YN = 'Y' ) C								");
			sql.append("\r\n").append("										WHERE A.IN_OUT_DETAIL = C.CD																											");
			sql.append("\r\n").append("									) IO_CD , 																																	");
			sql.append("\r\n").append("									(																																			");
			sql.append("\r\n").append("										--퇴근 ROW에 출근유형 추가																													");
			sql.append("\r\n").append("										SELECT 																																	");
			sql.append("\r\n").append("												AI.IN_OUT_DETAIL AS IN_DETAIL , A.*																								");
			sql.append("\r\n").append("										FROM 																																	");
			sql.append("\r\n").append("												TB_ATTEND A , 																													");
			sql.append("\r\n").append("												(SELECT YYYYMMDD , EMP_NO , IN_OUT_TP , IN_OUT_DETAIL  FROM TB_ATTEND WHERE IN_OUT_TP = 'I') AI									");
			sql.append("\r\n").append("										WHERE	--근태날짜와 사번만 조인																												");
			sql.append("\r\n").append("												A.YYYYMMDD = AI.YYYYMMDD 	--근태날짜																							");
			sql.append("\r\n").append("												AND 																																				");		
			sql.append("\r\n").append("												A.EMP_NO = AI.EMP_NO			--사번																												");
			sql.append("\r\n").append("												AND     A.YYYYMMDD   BETWEEN    REPLACE('"+hmCondition.get("s_date")+"' , '-' , '')  AND    REPLACE('"+hmCondition.get("e_date")+"' , '-' , '')		");
			sql.append("\r\n").append("									) IO_IN																																							");
			sql.append("\r\n").append("								WHERE	IO_CD.YYYYMMDD = IO_IN.YYYYMMDD																																");
			sql.append("\r\n").append("										AND																																							");
			sql.append("\r\n").append("										IO_CD.EMP_NO = IO_IN.EMP_NO																																	");
			sql.append("\r\n").append("										AND 																																						");
			sql.append("\r\n").append("										IO_CD.IN_OUT_TP = IO_IN.IN_OUT_TP																															");
			sql.append("\r\n").append("							) IO ,																																									");
			sql.append("\r\n").append("							V_DEPT	VD																																								");
			sql.append("\r\n").append("							WHERE IO.EMP_NO = VD.EMP_NO	AND 	VD.EMP_NO = 	"+emp_no+"																											");
			sql.append("\r\n").append("					) XX LEFT OUTER JOIN TB_COMM_CD 	C 		ON 	XX.IN_OUT_PLACE 	= 	C.CD 			--출퇴근지명칭 																			");
			sql.append("\r\n").append("					LEFT JOIN TB_COMM_CD 				A_CD 	ON 	XX.ADVANTAGE 		= 	A_CD.CD			--휴가반영 																				");
			sql.append("\r\n").append("					LEFT JOIN TB_EMP 					E 		ON 	XX.APPROV_EMP_NO 	= 	E.EMP_NO		--확인자 																					");
			sql.append("\r\n").append("					LEFT JOIN TB_ATTEND_CLOSE 			F 		ON  XX.YYYYMMDD 		=	F.CLOSE_DT		--마감여부 																				");
			sql.append("\r\n").append("					--     JOIN TB_AUTH_DEPT 				AZ 		ON 	XX.TEAM_NO 			= 	AZ.DEPT_NO 	 	AND 	AZ.EMP_NO =	"+emp_no+" 															");
			sql.append("\r\n").append("																																																	");
			sql.append("\r\n").append("					/*출근유형 AND 퇴근유형 START*/																																						");
			
			sql.append("\r\n").append("						 JOIN TB_ATTEND				IA		ON  XX.YYYYMMDD			=	IA.YYYYMMDD	AND XX.EMP_NO = IA.EMP_NO	AND IA.IN_OUT_TP = 'I'	");
			
			//결근이 선택되지 않았을 경우
			if (!hmCondition.get("absence_type").equals(CodeMetrix.NN) ) {
				//출근상세
				if (!hmCondition.get("chk_in_type").equals(CodeMetrix.ALL)) {
					sql.append("\r\n").append("						 AND IA.IN_OUT_DETAIL = '"+hmCondition.get("chk_in_type")+"'				");
				}
				
			}
			
			sql.append("\r\n").append("						 JOIN TB_ATTEND				OA		ON  XX.YYYYMMDD			=   OA.YYYYMMDD AND XX.EMP_NO = OA.EMP_NO	AND OA.IN_OUT_TP = 'O'	");
			
			//결근이 선택되지 않았을 경우
			if (!hmCondition.get("absence_type").equals(CodeMetrix.NN) ) {
				if (!hmCondition.get("chk_out_type").equals(CodeMetrix.ALL)) {
					sql.append("\r\n").append("						 AND OA.IN_OUT_DETAIL = '"+hmCondition.get("chk_out_type")+"'			");
				} 
				
			}
			
			sql.append("\r\n").append("					/*출근유형 AND 퇴근유형 END*/																																						");
			sql.append("\r\n").append("																																																	");
			sql.append("\r\n").append("				WHERE 1	=	1																																										");
			sql.append("\r\n").append("					  /*조회조건 START*/																																								");
			sql.append("\r\n").append("					  --AND	GROUP_NO 	LIKE	REPLACE('"+hmCondition.get("sgroup")+"' , 'ALL' , '%')		--	그룹																					");
			sql.append("\r\n").append("					  --AND 	TEAM_NO		LIKE	REPLACE('"+hmCondition.get("steam")+"' , 'ALL' , '%')		--	팀																						");
			//sql.append("\r\n").append("					  AND 	XX.EMP_NO	LIKE	REPLACE('"+hmCondition.get("semp_no")+"' , 'ALL' , '%')																								");
			
			/**특근조회 S T A R T**/
			if (hmCondition.get("sp_work_type").equals("SWO")) {
				
				if (hmCondition.get("sp_work_gubun").equals(CodeMetrix.ALL)) {
					
					sql.append("\r\n").append("					  AND (	IA.IN_OUT_DETAIL IN	(	'0006'	) 																");
					sql.append("\r\n").append("					  OR 	OA.IN_OUT_DETAIL IN	(	'1005'	,	'1008' 	) 		)											");
				} else if (hmCondition.get("sp_work_gubun").equals("1005")) {	//철야
					sql.append("\r\n").append("					  AND 	OA.IN_OUT_DETAIL =		'"+hmCondition.get("sp_work_gubun")+"' 					 				");
				} else if (hmCondition.get("sp_work_gubun").equals("0006")) {	//
					sql.append("\r\n").append("					  AND 	IA.IN_OUT_DETAIL =		'"+hmCondition.get("sp_work_gubun")+"' 					 				");
				}
				
			} else if (hmCondition.get("sp_work_type").equals("SWX")) {
				sql.append("\r\n").append("					  AND (	IA.IN_OUT_DETAIL !=	'0006'	 																");
				sql.append("\r\n").append("					  AND 	OA.IN_OUT_DETAIL NOT	IN	(	'1005' ,	'1008' 	) 		)											");
			}
			/**특근조회 E   N   D**/
			
			//추가 휴가반영 검색조건
			if (hmCondition.get("addVacation").equals("AVO")) {
				if (hmCondition.get("addVacation_gubun").equals(CodeMetrix.ALL)) {
					sql.append("\r\n").append("						AND     OA.ADVANTAGE             IN   ( '3302' , '3303' )		--반일 + 일일휴가																			");
				} else {
					sql.append("\r\n").append("						AND     OA.ADVANTAGE             =   '"+hmCondition.get("addVacation_gubun")+"'						");
				}
			} else	if (hmCondition.get("addVacation").equals("AVX")) {
				sql.append("\r\n").append("						AND    ( OA.ADVANTAGE             =    '3301' OR LEN(OA.ADVANTAGE) = 0 OR OA.ADVANTAGE = '' )		--반일 + 일일휴가											");
			}			
			
			//사번이 ALL인 경우에 쿼리에서 제외한다.
			if (!hmCondition.get("semp_no").equals(CodeMetrix.ALL) &&  hmCondition.get("searchEmpNm").equals("")) {
				sql.append("\r\n").append("					  --AND     XX.EMP_NO                    =   '"+hmCondition.get("semp_no")+"'                    																				");
			} else
				
				//사원검색일 경우 추가됨
				if ( (hmCondition.get("semp_no").equals(CodeMetrix.ALL) || hmCondition.get("semp_no").equals("")) &&  !hmCondition.get("searchEmpNm").equals("")) {
					sql.append("\r\n").append("					  --AND     XX.EMP_NM                    LIKE    '"+hmCondition.get("searchEmpNm")+"%'                   																		");
				}
			
			//확인여부가 ALL인경우 쿼리에서 제외시킴
			if (!hmCondition.get("confirm_yn").equals(CodeMetrix.ALL)) {
				sql.append("\r\n").append("					  AND     XX.CONFIRM_YN                =   '"+hmCondition.get("confirm_yn")+"' --확인여부																						");
			}
			
			//관리자 변경 여부가 ALL이 아닌경우 쿼리에서 제외시킴
			if (!hmCondition.get("mgr_change_yn").equals(CodeMetrix.ALL)) {
				sql.append("\r\n").append("					  AND     XX.MGR_CHANGE_YN             =   '" + hmCondition.get("mgr_change_yn") + "'  --CASE ? WHEN 'ALL' THEN '%' ELSE THEN ? END											");
			}
			
			sql.append("\r\n").append("					  AND   XX.IN_OUT_TP LIKE  	REPLACE('" + hmCondition.get("in_out_tp_condi") + "' , 'ALL' , '%')			--출퇴근분류 																");
			
			//결근
			if (hmCondition.get("absence_type").equals(CodeMetrix.NN) ) {
//		    	sql.append("\r\n").append("				AND	  XX.IN_OUT_DETAIL = '"+hmCondition.get("absence_type")+"'   --결근																											");
				sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL LIKE	REPLACE('"+hmCondition.get("absence_type")+"' , 'ALL' , '%')	--출퇴근유형상세 																");
			}
			
			/**휴가조회 START**/
			if(hmCondition.get("vacation_yn").equals("VCO")) {     //휴가여부가 휴가이면,,
							
				if (hmCondition.get("vacation_type").equals(CodeMetrix.ALL)) {  //모든 휴가
					sql.append("\r\n").append("	 AND 	XX.IN_OUT_DETAIL IN ( '0004' , '0005' , '0007' , '0008' , '0009' , '1006' , '1007' , '1009' , '1010' , '1011' , '2001' , '2002' , '2003' , '2004' , '2005'  ) 	");
					
				}else if (hmCondition.get("vacation_type").equals("VSO")) {		//연차관련
					
					if (hmCondition.get("vacation_gubun").equals(CodeMetrix.ALL)) { //모든 연차관련휴가(연차 + 특별)
						sql.append("\r\n").append("					  AND XX.IN_OUT_DETAIL  IN ( '0004' , '1006' , '2001' , '0007' , '1009' , '2002'  )	");
						
					} else if (hmCondition.get("vacation_gubun").equals("2001")) {	//연차						
						if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 연차휴가						
							sql.append("\r\n").append("			 AND 	XX.IN_OUT_DETAIL IN ( '0004' , '1006' , '2001' ) 	 ");
						}else if(hmCondition.get("vacation_detail").equals("HDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
							sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0004' AND OA.IN_OUT_DETAIL = '1006') OR (IA.IN_OUT_DETAIL = '2001' AND OA.IN_OUT_DETAIL = '2001')  ");
						}else if(hmCondition.get("vacation_detail").equals("HHD")) {   //반일휴가 
							if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
								sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0004' AND OA.IN_OUT_DETAIL != '1006' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0004' AND OA.IN_OUT_DETAIL = '1006' AND XX.IN_OUT_TP = 'O'))	");
							}else if(hmCondition.get("h_vacation_type").equals("0004")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0004'	AND OA.IN_OUT_DETAIL != '1006' AND XX.IN_OUT_TP = 'I' ");					
							}else if(hmCondition.get("h_vacation_type").equals("1006")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0004'	AND OA.IN_OUT_DETAIL = '1006' AND XX.IN_OUT_TP = 'O' ");								
							}
						}
						//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");

					} else if (hmCondition.get("vacation_gubun").equals("2002")) {	//특별
						if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 특별휴가						
							sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0007' , '1009' , '2002' ) 	 				");
						}else if(hmCondition.get("vacation_detail").equals("SDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
							sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0007' AND OA.IN_OUT_DETAIL = '1009') OR (IA.IN_OUT_DETAIL = '2002' AND OA.IN_OUT_DETAIL = '2002')  ");
						}else if(hmCondition.get("vacation_detail").equals("SHD")) {   //반일휴가 
							if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
								sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0007' AND OA.IN_OUT_DETAIL != '1009' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0007' AND OA.IN_OUT_DETAIL = '1009' AND XX.IN_OUT_TP = 'O'))	");
							}else if(hmCondition.get("h_vacation_type").equals("0004")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0007'	AND OA.IN_OUT_DETAIL != '1009' AND XX.IN_OUT_TP = 'I' ");				
							}else if(hmCondition.get("h_vacation_type").equals("1006")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0007'	AND OA.IN_OUT_DETAIL = '1009' AND XX.IN_OUT_TP = 'O' ");								
							}
						}
						//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
						
					} //else if (hmCondition.get("vacation_gubun").equals("HFV")) {	//반일연차
						//if (hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
						//	sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN		( '0004' , '1006' ) 	--// 													");
							
						//} else if (hmCondition.get("h_vacation_type").equals("0004")) {
						//	sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL =		'"+hmCondition.get("h_vacation_type")+"'  	--// 				");
						//} else if (hmCondition.get("h_vacation_type").equals("1006")) {
						//	sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL =		 '"+hmCondition.get("h_vacation_type")+"'  	--// 				");
						//}
						
					//}
				}else if (hmCondition.get("vacation_type").equals("VSX")) {		//연차외
					
					//if (hmCondition.get("vacation_gubun").equals("HFO")) {	//반일공가
						
					//	if (hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
					//		sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN		( '0005' , '1007' ) 	--// 									");
					//	} else {
					//		sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL =		'"+hmCondition.get("h_vacation_type")+"'  	--// 				");
					//	}
					//} 
					//else 
					if (hmCondition.get("vacation_gubun").equals(CodeMetrix.ALL)) {	// 모든 연차외 휴가(경조+공가+기타)
						sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0005' , '1007' , '2004' , '0008' , '1010' , '2003' , '0009' , '1011' , '2005'  )   			");
						//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
					} else if (hmCondition.get("vacation_gubun").equals("2003")) {	//경조
						if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 경조휴가						
							sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0008' , '1010' , '2003' ) 	 				");
						}else if(hmCondition.get("vacation_detail").equals("FDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
							sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0008' AND OA.IN_OUT_DETAIL = '1010') OR (IA.IN_OUT_DETAIL = '2003' AND OA.IN_OUT_DETAIL = '2003')  ");
						}else if(hmCondition.get("vacation_detail").equals("FHD")) {   //반일휴가 
							if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
								sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0008' AND OA.IN_OUT_DETAIL != '1010' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0008' AND OA.IN_OUT_DETAIL = '1010' AND XX.IN_OUT_TP = 'O'))	");
							}else if(hmCondition.get("h_vacation_type").equals("0004")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0008'	AND OA.IN_OUT_DETAIL != '1010' AND XX.IN_OUT_TP = 'I' ");				
							}else if(hmCondition.get("h_vacation_type").equals("1006")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0008'	AND OA.IN_OUT_DETAIL = '1010' AND XX.IN_OUT_TP = 'O' ");						
							}
						}
						
					
						//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
					} else if (hmCondition.get("vacation_gubun").equals("2004")) {	//공가
						if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 공가					
							sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0005' , '1007' , '2004' ) 	 				");
						}else if(hmCondition.get("vacation_detail").equals("GDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
							sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0005' AND OA.IN_OUT_DETAIL = '1007') OR (IA.IN_OUT_DETAIL = '2004' AND OA.IN_OUT_DETAIL = '2004')  ");
						}else if(hmCondition.get("vacation_detail").equals("GHD")) {   //반일휴가 
							if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
								sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0005' AND OA.IN_OUT_DETAIL != '1007' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0005' AND OA.IN_OUT_DETAIL = '1007' AND XX.IN_OUT_TP = 'O'))	");
							}else if(hmCondition.get("h_vacation_type").equals("0004")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0005'	AND OA.IN_OUT_DETAIL != '1007' AND XX.IN_OUT_TP = 'I' ");				
							}else if(hmCondition.get("h_vacation_type").equals("1006")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0005'	AND OA.IN_OUT_DETAIL = '1007' AND XX.IN_OUT_TP = 'O' ");	
							}							
						}
					
						//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
					} else if (hmCondition.get("vacation_gubun").equals("2005")) {	//기타
						if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 기타휴가						
							sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0009' , '1011' , '2005' ) 	 				");
						}else if(hmCondition.get("vacation_detail").equals("EDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
							sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0009' AND OA.IN_OUT_DETAIL = '1011') OR (IA.IN_OUT_DETAIL = '2005' AND OA.IN_OUT_DETAIL = '2005')  ");
						}else if(hmCondition.get("vacation_detail").equals("EHD")) {   //반일휴가 
							if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
								sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0009' AND OA.IN_OUT_DETAIL != '1011' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0009' AND OA.IN_OUT_DETAIL = '1011' AND XX.IN_OUT_TP = 'O'))	");
							}else if(hmCondition.get("h_vacation_type").equals("0004")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0009'	AND OA.IN_OUT_DETAIL != '1011' AND XX.IN_OUT_TP = 'I' ");					
							}else if(hmCondition.get("h_vacation_type").equals("1006")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0009'	AND OA.IN_OUT_DETAIL = '1011' AND XX.IN_OUT_TP = 'O' ");
							}							
						}
					}
						
						//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
				} else {
						//sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN		('0005' , '1007' , '2003' , '2004' , '2005'  )	--// 				");
						sql.append("\r\n").append("					  AND (XX.IN_OUT_DETAIL  IN ( '0005' , '1007' ) OR XX.IN_OUT_DETAIL IN ( '2003' , '2004' , '2005'  ) AND XX.IN_OUT_TP = 'O')		");
					}
					
			}

			if(hmCondition.get("vacation_yn").equals("VCX")) {     //휴가여부가 미휴가이면,,
				sql.append("\r\n").append("		AND 	XX.IN_OUT_DETAIL IN		( '0001' , '0002' , '0003'  , '0006' , '1001' , '1002' , '1003' , '1004' , '1005' , '1008' )   ");
			}
			
			/**휴가조회 END**/			//휴가유형			sql.append("\r\n").append("					  /*조회조건 END*/																																						");
			sql.append("\r\n").append("					  																																										");
			sql.append("\r\n").append("			) Z																																												");
			sql.append("\r\n").append("			WHERE 1=1	  AND	ROWNUM BETWEEN " + start_row + " AND " + end_row 			);
			
						
			logger.info("------------------------------근태관리-관리자-근태확인44444 LIST START---------------------------------");
			logger.info(sql);
			logger.info("------------------------------근태관리-관리자-근태확인44444 LIST END---------------------------------");
			
			pstmt 	= con.prepareStatement(sql.toString());
			
			/**************************************************************************/
			//P A R A M E T E R		V A L U E S		S T A R T
			/**************************************************************************/
			/**************************************************************************/
			//P A R A M E T E R		V A L U E S		E   N   D
			/**************************************************************************/
			
			rs		= pstmt.executeQuery();
			
			System.out.println("근태조회55555<<<<<<<<<<<<<<<<<<<");			
			System.out.println(sql.toString());
			System.out.println("근태조회55555>>>>>>>>>>>>>>>>>>>");
			
			while (rs.next()) {
				
				HashMap<String , String>  hash_map = new HashMap<String, String>();
				
				hash_map.put("대소문자로 구분하여 사용할 것." , "디비에서는 상관없음.");
				
				//jsp에서 <s:property value='upper_dept_no'/> 와 같아야 함.
				hash_map.put("rownum" 				, rs.getString("ROWNUM") );				//ROWNUM
				hash_map.put("group_nm" 			, rs.getString("GROUP_NM") );			//그룹
				hash_map.put("group_nm_tt" 			, rs.getString("GROUP_NM_TT") );			//그룹
				hash_map.put("team_nm"				, rs.getString("TEAM_NM") );			//팀
				hash_map.put("aemp_no"				, rs.getString("EMP_NO") );				//사번	//aemp_no
				hash_map.put("emp_nm"				, rs.getString("EMP_NM") );				//성명
				hash_map.put("yyyymmdd"				, rs.getString("YYYYMMDD") );			//기준일
				hash_map.put("dayname"				, rs.getString("DAYNAME") );			//요일
				hash_map.put("in_out_tp"			, rs.getString("IN_OUT_TP") );			//출근일짜
				hash_map.put("in_out_tp_nm"			, rs.getString("IN_OUT_TP_NM") );			//출근일짜
				hash_map.put("in_out_dt"			, rs.getString("IN_OUT_DT") );			//출근일짜
				hash_map.put("in_out_time"			, rs.getString("IN_OUT_TIME") );		//출근시간
				hash_map.put("reg_ip"				, rs.getString("REG_IP") );				//입력된 IP
				hash_map.put("in_detail"			, rs.getString("IN_DETAIL") );		//퇴근ROW의 출근태상세 code	//2009-03-31
				hash_map.put("in_out_detail"		, rs.getString("IN_OUT_DETAIL") );		//근태상세 code
				hash_map.put("in_out_detail_nm"		, rs.getString("IN_OUT_DETAIL_NM") );	//근태상세
				hash_map.put("in_out_place_nm"		, rs.getString("IN_OUT_PLACE_NM") );	//
				hash_map.put("etc_emp"				, rs.getString("ETC_EMP") );			//입력자 비고
				hash_map.put("etc_emp_memo"			, rs.getString("ETC_EMP_MEMO") );			//입력자 비고
				hash_map.put("update_dt"			, rs.getString("UPDATE_DT") );			//확인시간
				hash_map.put("etc_mgr"				, rs.getString("ETC_MGR") );			//확인자 비고
				hash_map.put("approv_emp_no"		, rs.getString("APPROV_EMP_NO") );		//확인자 사번
				hash_map.put("approv_emp_nm"		, rs.getString("APPROV_EMP_NM") );		//확인자 성명
				hash_map.put("approv_emp_nm_tt"		, rs.getString("APPROV_EMP_NM_TT") );		//확인자 성명
				hash_map.put("mgr_change_yn"		, rs.getString("MGR_CHANGE_YN") );		//확인자 유형상세 변경여부
         		hash_map.put("confirm_yn"		    , rs.getString("CONFIRM_YN") );       ////////
				hash_map.put("close_dt"				, rs.getString("CLOSE_DT") );		//확인자 유형상세 변경여부
				hash_map.put("advantage"			, rs.getString("ADVANTAGE") );		//
				hash_map.put("advantage_nm"			, rs.getString("ADVANTAGE_NM") );		//휴가
				
				list.add(hash_map);	// 한행의 데이터인 맵객체를 담는다.
				
			}
			
			if (hmCondition.get("confirm_yn").equals(CodeMetrix.NO) && list.size() == 0) {
				p_count	=	CodeMetrix.ZERO;
			} else {
				p_count =	list.size();
			}
			
		} catch (SQLException se) {
			se.printStackTrace();
			BaseException dex = new BaseException();                
			dex.setException(se);
			dex.setAppReturnCode("10");
			throw dex;
		} catch(Exception e) {
			BaseException dex = new BaseException();                
			dex.setException(e);
			dex.setAppReturnCode("20");
			throw dex;
		} finally {
			try {
				if (pstmt != null) pstmt.close();
				if (rs != null) rs.close();
				if(con != null) con.close();
				
			} catch(SQLException fse) {
				BaseException dex = new BaseException();                
				dex.setException(fse);
				dex.setAppReturnCode("10");
				throw dex;
			}
		}
	}
	
public void retireveReqAttendList(HashMap<String, String> hmCondition , int start_row , int end_row , int emp_no) throws BaseException , SQLException {
		
		//System.out.println("안녕~~~~~~~~~~~~~~~~~~~~~~~");
		
	logger.info(hmCondition);
	con = super.getDataSource().getConnection();
	
	try {
		list = new ArrayList<HashMap<String,String>>();
		
		sql.setLength(0);
		
		sql.append("\r\n").append("			SELECT Z.*																																							");
		sql.append("\r\n").append("			FROM																																								");
		sql.append("\r\n").append("			(																																									");
		sql.append("\r\n").append("				SELECT  ROW_NUMBER() OVER( ORDER BY XX.YYYYMMDD DESC , XX.EMP_NO , XX.IN_OUT_TP , XX.GROUP_NO , XX.TEAM_NO ) ROWNUM,											");
		sql.append("\r\n").append("						CASE WHEN CHARINDEX('(' ,XX.GROUP_NM	) = 0 THEN XX.GROUP_NM ELSE SUBSTRING(XX.GROUP_NM , 1 , (CHARINDEX('(' ,XX.GROUP_NM	) - 1))	 END AS GROUP_NM			,		");
		sql.append("\r\n").append("						XX.GROUP_NM 	AS  GROUP_NM_TT			,																												");
		sql.append("\r\n").append("						XX.TEAM_NO				,																																");
		sql.append("\r\n").append("						XX.TEAM_NM				,																																");
		sql.append("\r\n").append("						XX.EMP_NO				,																																");
		sql.append("\r\n").append("						XX.EMP_NM				,																																");
		sql.append("\r\n").append("						XX.IN_OUT_DETAIL		,																																");
		sql.append("\r\n").append("						XX.IN_OUT_DETAIL_NM		,																																");
		sql.append("\r\n").append("						XX.IN_DETAIL			,																																");
		sql.append("\r\n").append("						XX.YYYYMMDD				,																																");
		sql.append("\r\n").append("						SUBSTRING(DATENAME(DW , CONVERT(SMALLDATETIME , XX.YYYYMMDD) ) ,1 ,1) AS  DAYNAME ,																		");
		sql.append("\r\n").append("						XX.IN_OUT_TP			,																																");
		sql.append("\r\n").append("						CASE WHEN XX.IN_OUT_TP = 'I' THEN  '출' ELSE '퇴' END IN_OUT_TP_NM 		,																				");
		sql.append("\r\n").append("						SUBSTRING(XX.IN_OUT_DT,5,8) AS IN_OUT_DT			,																									");
		sql.append("\r\n").append("						SUBSTRING(XX.IN_OUT_TIME,1,2) + ':' + SUBSTRING(XX.IN_OUT_TIME,3,4)	AS IN_OUT_TIME		,														    ");
		sql.append("\r\n").append("						XX.IN_OUT_PLACE			,																																");
		sql.append("\r\n").append("						C.CD_NM AS IN_OUT_PLACE_NM ,																															");
		sql.append("\r\n").append("						XX.ETC_EMP				,																																");
		sql.append("\r\n").append("						SUBSTRING(XX.ETC_EMP , 1 , 10) AS ETC_EMP_MEMO 	, 																										");
		sql.append("\r\n").append("						XX.ETC_MGR				,																																");
		sql.append("\r\n").append("						XX.REG_IP				,																																");
		sql.append("\r\n").append("						XX.MGR_CHANGE_YN		,																																");
		sql.append("\r\n").append("						XX.UPDATE_DT			,																																");
		sql.append("\r\n").append("						XX.APPROV_EMP_NO		,																																");
		sql.append("\r\n").append("						SUBSTRING(E.EMP_NM , 1, 3)	AS APPROV_EMP_NM		,																									");
		sql.append("\r\n").append("						E.EMP_NM 	AS APPROV_EMP_NM_TT		                ,																									");
		sql.append("\r\n").append("						XX.CONFIRM_YN			,																																");
		sql.append("\r\n").append("						XX.ADVANTAGE			,																																");
		sql.append("\r\n").append("						A_CD.ETC AS ADVANTAGE_NM,																																");
		sql.append("\r\n").append("                     XX.REQ_YN               ,                                                                                                                               ");
		sql.append("\r\n").append("                     XX.REQ_DETAIL               ,                                                                                                                               ");
		sql.append("\r\n").append("                     CASE WHEN XX.REQ_YN = 'N' THEN  '요청중' WHEN XX.REQ_YN = 'Y' THEN  '완료' END IN_REQ_YN_NM ,                                                            ");
		sql.append("\r\n").append("						CASE WHEN (F.CLOSE_DT is null ) THEN 'N' ELSE 'Y' END  CLOSE_DT																							");
		sql.append("\r\n").append("				FROM																																							");
		sql.append("\r\n").append("				(																																								");
		sql.append("\r\n").append("						SELECT 																																					");
		sql.append("\r\n").append("								--ROW_NUMBER() OVER( ORDER BY IO.YYYYMMDD DESC , IO.EMP_NO , IO.IN_OUT_TP , VD.GROUP_NO , VD.TEAM_NO ) ROWNUM,									");
		sql.append("\r\n").append("								VD.GROUP_NO		,	VD.GROUP_NM,																												");
		sql.append("\r\n").append("								VD.TEAM_NO		,	VD.TEAM_NM,																													");
		sql.append("\r\n").append("								IO.EMP_NO		,	VD.EMP_NM,																													");
		sql.append("\r\n").append("								IO.IN_OUT_DETAIL,	IO.IN_OUT_DETAIL_NM,																										");
		sql.append("\r\n").append("								IO.IN_DETAIL	,																																");
		sql.append("\r\n").append("								IO.YYYYMMDD		,		IO.IN_OUT_TP,				--PK ROW																					");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.IN_OUT_DT,																																	");
		sql.append("\r\n").append("								IO.IN_OUT_TIME,																																	");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.IN_OUT_PLACE,																																");
		sql.append("\r\n").append("								IO.IN_OUT_PLACE_NM,																																");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.ETC_EMP,																																		");
		sql.append("\r\n").append("								IO.ETC_MGR,																																		");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.REG_IP,																																		");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.MGR_CHANGE_YN,																																");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.UPDATE_DT,																																	");
		sql.append("\r\n").append("								IO.APPROV_EMP_NO,																																");
		sql.append("\r\n").append("								IO.CONFIRM_YN,																																	");
		sql.append("\r\n").append("								IO.ADVANTAGE ,																																	");
		sql.append("\r\n").append("                             IO.REQ_YN    ,                                                                                                                                      ");
		sql.append("\r\n").append("                             IO.REQ_DETAIL                                                                                                                                      ");
		sql.append("\r\n").append("						FROM																																					");
		sql.append("\r\n").append("							(																																					");
		sql.append("\r\n").append("								SELECT  IO_CD.IN_OUT_DETAIL_NM ,																												");
		sql.append("\r\n").append("												IO_IN.*																															");
		sql.append("\r\n").append("								FROM 																																			");
		sql.append("\r\n").append("									(																																			");
		sql.append("\r\n").append("										--출퇴근유형																																");
		sql.append("\r\n").append("										SELECT A.YYYYMMDD , A.IN_OUT_TP , A.EMP_NO , A.IN_OUT_DETAIL, C.GROUP_CD, C.CD_NM AS IN_OUT_DETAIL_NM, C.ETC							");
		sql.append("\r\n").append("											FROM TB_ATTEND A, ( SELECT * FROM TB_COMM_CD WHERE ETC_CD IS NULL AND CD != '0' AND USE_YN = 'Y' ) C								");
		sql.append("\r\n").append("										WHERE A.IN_OUT_DETAIL = C.CD																											");
		sql.append("\r\n").append("									) IO_CD , 																																	");
		sql.append("\r\n").append("									(																																			");
		sql.append("\r\n").append("										--퇴근 ROW에 출근유형 추가																													");
		sql.append("\r\n").append("										SELECT 																																	");
		sql.append("\r\n").append("												AI.IN_OUT_DETAIL AS IN_DETAIL , A.*																								");
		sql.append("\r\n").append("										FROM 																																	");
		sql.append("\r\n").append("												TB_ATTEND A , 																													");
		sql.append("\r\n").append("												(SELECT YYYYMMDD , EMP_NO , IN_OUT_TP , IN_OUT_DETAIL  FROM TB_ATTEND WHERE IN_OUT_TP = 'I') AI									");
		sql.append("\r\n").append("										WHERE	--근태날짜와 사번만 조인																												");
		sql.append("\r\n").append("												A.YYYYMMDD = AI.YYYYMMDD 	--근태날짜																							");
		sql.append("\r\n").append("												AND 																																				");		
		sql.append("\r\n").append("												A.EMP_NO = AI.EMP_NO			--사번																												");
		sql.append("\r\n").append("												AND     A.YYYYMMDD   BETWEEN    REPLACE('"+hmCondition.get("s_date")+"' , '-' , '')  AND    REPLACE('"+hmCondition.get("e_date")+"' , '-' , '')		");
		sql.append("\r\n").append("									) IO_IN																																							");
		sql.append("\r\n").append("								WHERE	IO_CD.YYYYMMDD = IO_IN.YYYYMMDD																																");
		sql.append("\r\n").append("										AND																																							");
		sql.append("\r\n").append("										IO_CD.EMP_NO = IO_IN.EMP_NO																																	");
		sql.append("\r\n").append("										AND 																																						");
		sql.append("\r\n").append("										IO_CD.IN_OUT_TP = IO_IN.IN_OUT_TP																															");
		sql.append("\r\n").append("							) IO ,																																									");
		sql.append("\r\n").append("							V_DEPT	VD																																								");
		sql.append("\r\n").append("							WHERE IO.EMP_NO = VD.EMP_NO	AND 	VD.EMP_NO = 	"+emp_no+"																											");
		sql.append("\r\n").append("					) XX LEFT OUTER JOIN TB_COMM_CD 	C 		ON 	XX.IN_OUT_PLACE 	= 	C.CD 			--출퇴근지명칭 																			");
		sql.append("\r\n").append("					LEFT JOIN TB_COMM_CD 				A_CD 	ON 	XX.ADVANTAGE 		= 	A_CD.CD			--휴가반영 																				");
		sql.append("\r\n").append("					LEFT JOIN TB_EMP 					E 		ON 	XX.APPROV_EMP_NO 	= 	E.EMP_NO		--확인자 																					");
		sql.append("\r\n").append("					LEFT JOIN TB_ATTEND_CLOSE 			F 		ON  XX.YYYYMMDD 		=	F.CLOSE_DT		--마감여부 																				");
		sql.append("\r\n").append("					--     JOIN TB_AUTH_DEPT 				AZ 		ON 	XX.TEAM_NO 			= 	AZ.DEPT_NO 	 	AND 	AZ.EMP_NO =	"+emp_no+" 															");
		sql.append("\r\n").append("																																																	");
		sql.append("\r\n").append("					/*출근유형 AND 퇴근유형 START*/																																						");
		
		sql.append("\r\n").append("						 JOIN TB_ATTEND				IA		ON  XX.YYYYMMDD			=	IA.YYYYMMDD	AND XX.EMP_NO = IA.EMP_NO	AND IA.IN_OUT_TP = 'I'	");
		
		//결근이 선택되지 않았을 경우
		if (!hmCondition.get("absence_type").equals(CodeMetrix.NN) ) {
			//출근상세
			if (!hmCondition.get("chk_in_type").equals(CodeMetrix.ALL)) {
				sql.append("\r\n").append("						 AND IA.IN_OUT_DETAIL = '"+hmCondition.get("chk_in_type")+"'				");
			}
			
		}
		
		sql.append("\r\n").append("						 JOIN TB_ATTEND				OA		ON  XX.YYYYMMDD			=   OA.YYYYMMDD AND XX.EMP_NO = OA.EMP_NO	AND OA.IN_OUT_TP = 'O'	");
		
		//결근이 선택되지 않았을 경우
		if (!hmCondition.get("absence_type").equals(CodeMetrix.NN) ) {
			if (!hmCondition.get("chk_out_type").equals(CodeMetrix.ALL)) {
				sql.append("\r\n").append("						 AND OA.IN_OUT_DETAIL = '"+hmCondition.get("chk_out_type")+"'			");
			} 
			
		}
		
		sql.append("\r\n").append("					/*출근유형 AND 퇴근유형 END*/																																						");
		sql.append("\r\n").append("																																																	");
		sql.append("\r\n").append("				WHERE 1	=	1																																										");
		sql.append("\r\n").append("					  /*조회조건 START*/																																								");
		sql.append("\r\n").append("					  --AND	GROUP_NO 	LIKE	REPLACE('"+hmCondition.get("sgroup")+"' , 'ALL' , '%')		--	그룹																					");
		sql.append("\r\n").append("					  --AND 	TEAM_NO		LIKE	REPLACE('"+hmCondition.get("steam")+"' , 'ALL' , '%')		--	팀																						");
		//sql.append("\r\n").append("					  AND 	XX.EMP_NO	LIKE	REPLACE('"+hmCondition.get("semp_no")+"' , 'ALL' , '%')																								");
		
		/**특근조회 S T A R T**/
		if (hmCondition.get("sp_work_type").equals("SWO")) {
			
			if (hmCondition.get("sp_work_gubun").equals(CodeMetrix.ALL)) {
				
				sql.append("\r\n").append("					  AND (	IA.IN_OUT_DETAIL IN	(	'0006'	) 																");
				sql.append("\r\n").append("					  OR 	OA.IN_OUT_DETAIL IN	(	'1005'	,	'1008' 	) 		)											");
			} else if (hmCondition.get("sp_work_gubun").equals("1005")) {	//철야
				sql.append("\r\n").append("					  AND 	OA.IN_OUT_DETAIL =		'"+hmCondition.get("sp_work_gubun")+"' 					 				");
			} else if (hmCondition.get("sp_work_gubun").equals("0006")) {	//
				sql.append("\r\n").append("					  AND 	IA.IN_OUT_DETAIL =		'"+hmCondition.get("sp_work_gubun")+"' 					 				");
			}
			
		} else if (hmCondition.get("sp_work_type").equals("SWX")) {
			sql.append("\r\n").append("					  AND (	IA.IN_OUT_DETAIL !=	'0006'	 																");
			sql.append("\r\n").append("					  AND 	OA.IN_OUT_DETAIL NOT	IN	(	'1005' ,	'1008' 	) 		)											");
		}
		/**특근조회 E   N   D**/
		
		//추가 휴가반영 검색조건
		if (hmCondition.get("addVacation").equals("AVO")) {
			if (hmCondition.get("addVacation_gubun").equals(CodeMetrix.ALL)) {
				sql.append("\r\n").append("						AND     OA.ADVANTAGE             IN   ( '3302' , '3303' )		--반일 + 일일휴가																			");
			} else {
				sql.append("\r\n").append("						AND     OA.ADVANTAGE             =   '"+hmCondition.get("addVacation_gubun")+"'						");
			}
		} else	if (hmCondition.get("addVacation").equals("AVX")) {
			sql.append("\r\n").append("						AND    ( OA.ADVANTAGE             =    '3301' OR LEN(OA.ADVANTAGE) = 0 OR OA.ADVANTAGE = '' )		--반일 + 일일휴가											");
		}			
		
		//사번이 ALL인 경우에 쿼리에서 제외한다.
		if (!hmCondition.get("semp_no").equals(CodeMetrix.ALL) &&  hmCondition.get("searchEmpNm").equals("")) {
			sql.append("\r\n").append("					  --AND     XX.EMP_NO                    =   '"+hmCondition.get("semp_no")+"'                    																				");
		} else
			
			//사원검색일 경우 추가됨
			if ( (hmCondition.get("semp_no").equals(CodeMetrix.ALL) || hmCondition.get("semp_no").equals("")) &&  !hmCondition.get("searchEmpNm").equals("")) {
				sql.append("\r\n").append("					  --AND     XX.EMP_NM                    LIKE    '"+hmCondition.get("searchEmpNm")+"%'                   																		");
			}
		
		//확인여부가 ALL인경우 쿼리에서 제외시킴
		if (!hmCondition.get("confirm_yn").equals(CodeMetrix.ALL)) {
			sql.append("\r\n").append("					  AND     XX.CONFIRM_YN                =   '"+hmCondition.get("confirm_yn")+"' --확인여부																						");
		}
		
		//관리자 변경 여부가 ALL이 아닌경우 쿼리에서 제외시킴
		if (!hmCondition.get("mgr_change_yn").equals(CodeMetrix.ALL)) {
			sql.append("\r\n").append("					  AND     XX.MGR_CHANGE_YN             =   '" + hmCondition.get("mgr_change_yn") + "'  --CASE ? WHEN 'ALL' THEN '%' ELSE THEN ? END											");
		}
		
		sql.append("\r\n").append("					  AND   XX.IN_OUT_TP LIKE  	REPLACE('" + hmCondition.get("in_out_tp_condi") + "' , 'ALL' , '%')			--출퇴근분류 																");
		
		//결근
		if (hmCondition.get("absence_type").equals(CodeMetrix.NN) ) {
//	    	sql.append("\r\n").append("				AND	  XX.IN_OUT_DETAIL = '"+hmCondition.get("absence_type")+"'   --결근																											");
			sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL LIKE	REPLACE('"+hmCondition.get("absence_type")+"' , 'ALL' , '%')	--출퇴근유형상세 																");
		}
		
		/**휴가조회 START**/
		if(hmCondition.get("vacation_yn").equals("VCO")) {     //휴가여부가 휴가이면,,
						
			if (hmCondition.get("vacation_type").equals(CodeMetrix.ALL)) {  //모든 휴가
				sql.append("\r\n").append("	 AND 	XX.IN_OUT_DETAIL IN ( '0004' , '0005' , '0007' , '0008' , '0009' , '1006' , '1007' , '1009' , '1010' , '1011' , '2001' , '2002' , '2003' , '2004' , '2005'  ) 	");
				
			}else if (hmCondition.get("vacation_type").equals("VSO")) {		//연차관련
				
				if (hmCondition.get("vacation_gubun").equals(CodeMetrix.ALL)) { //모든 연차관련휴가(연차 + 특별)
					sql.append("\r\n").append("					  AND XX.IN_OUT_DETAIL  IN ( '0004' , '1006' , '2001' , '0007' , '1009' , '2002'  )	");
					
				} else if (hmCondition.get("vacation_gubun").equals("2001")) {	//연차						
					if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 연차휴가						
						sql.append("\r\n").append("			 AND 	XX.IN_OUT_DETAIL IN ( '0004' , '1006' , '2001' ) 	 ");
					}else if(hmCondition.get("vacation_detail").equals("HDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
						sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0004' AND OA.IN_OUT_DETAIL = '1006') OR (IA.IN_OUT_DETAIL = '2001' AND OA.IN_OUT_DETAIL = '2001')  ");
					}else if(hmCondition.get("vacation_detail").equals("HHD")) {   //반일휴가 
						if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
							sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0004' AND OA.IN_OUT_DETAIL != '1006' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0004' AND OA.IN_OUT_DETAIL = '1006' AND XX.IN_OUT_TP = 'O'))	");
						}else if(hmCondition.get("h_vacation_type").equals("0004")) {
							sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0004'	AND OA.IN_OUT_DETAIL != '1006' AND XX.IN_OUT_TP = 'I' ");					
						}else if(hmCondition.get("h_vacation_type").equals("1006")) {
							sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0004'	AND OA.IN_OUT_DETAIL = '1006' AND XX.IN_OUT_TP = 'O' ");								
						}
					}
					//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");

				} else if (hmCondition.get("vacation_gubun").equals("2002")) {	//특별
					if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 특별휴가						
						sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0007' , '1009' , '2002' ) 	 				");
					}else if(hmCondition.get("vacation_detail").equals("SDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
						sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0007' AND OA.IN_OUT_DETAIL = '1009') OR (IA.IN_OUT_DETAIL = '2002' AND OA.IN_OUT_DETAIL = '2002')  ");
					}else if(hmCondition.get("vacation_detail").equals("SHD")) {   //반일휴가 
						if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
							sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0007' AND OA.IN_OUT_DETAIL != '1009' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0007' AND OA.IN_OUT_DETAIL = '1009' AND XX.IN_OUT_TP = 'O'))	");
						}else if(hmCondition.get("h_vacation_type").equals("0004")) {
							sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0007'	AND OA.IN_OUT_DETAIL != '1009' AND XX.IN_OUT_TP = 'I' ");				
						}else if(hmCondition.get("h_vacation_type").equals("1006")) {
							sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0007'	AND OA.IN_OUT_DETAIL = '1009' AND XX.IN_OUT_TP = 'O' ");								
						}
					}
					//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
					
				} //else if (hmCondition.get("vacation_gubun").equals("HFV")) {	//반일연차
					//if (hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
					//	sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN		( '0004' , '1006' ) 	--// 													");
						
					//} else if (hmCondition.get("h_vacation_type").equals("0004")) {
					//	sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL =		'"+hmCondition.get("h_vacation_type")+"'  	--// 				");
					//} else if (hmCondition.get("h_vacation_type").equals("1006")) {
					//	sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL =		 '"+hmCondition.get("h_vacation_type")+"'  	--// 				");
					//}
					
				//}
			}else if (hmCondition.get("vacation_type").equals("VSX")) {		//연차외
				
				//if (hmCondition.get("vacation_gubun").equals("HFO")) {	//반일공가
					
				//	if (hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
				//		sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN		( '0005' , '1007' ) 	--// 									");
				//	} else {
				//		sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL =		'"+hmCondition.get("h_vacation_type")+"'  	--// 				");
				//	}
				//} 
				//else 
				if (hmCondition.get("vacation_gubun").equals(CodeMetrix.ALL)) {	// 모든 연차외 휴가(경조+공가+기타)
					sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0005' , '1007' , '2004' , '0008' , '1010' , '2003' , '0009' , '1011' , '2005'  )   			");
					//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
				} else if (hmCondition.get("vacation_gubun").equals("2003")) {	//경조
					if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 경조휴가						
						sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0008' , '1010' , '2003' ) 	 				");
					}else if(hmCondition.get("vacation_detail").equals("FDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
						sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0008' AND OA.IN_OUT_DETAIL = '1010') OR (IA.IN_OUT_DETAIL = '2003' AND OA.IN_OUT_DETAIL = '2003')  ");
					}else if(hmCondition.get("vacation_detail").equals("FHD")) {   //반일휴가 
						if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
							sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0008' AND OA.IN_OUT_DETAIL != '1010' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0008' AND OA.IN_OUT_DETAIL = '1010' AND XX.IN_OUT_TP = 'O'))	");
						}else if(hmCondition.get("h_vacation_type").equals("0004")) {
							sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0008'	AND OA.IN_OUT_DETAIL != '1010' AND XX.IN_OUT_TP = 'I' ");				
						}else if(hmCondition.get("h_vacation_type").equals("1006")) {
							sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0008'	AND OA.IN_OUT_DETAIL = '1010' AND XX.IN_OUT_TP = 'O' ");						
						}
					}
					
				
					//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
				} else if (hmCondition.get("vacation_gubun").equals("2004")) {	//공가
					if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 공가					
						sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0005' , '1007' , '2004' ) 	 				");
					}else if(hmCondition.get("vacation_detail").equals("GDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
						sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0005' AND OA.IN_OUT_DETAIL = '1007') OR (IA.IN_OUT_DETAIL = '2004' AND OA.IN_OUT_DETAIL = '2004')  ");
					}else if(hmCondition.get("vacation_detail").equals("GHD")) {   //반일휴가 
						if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
							sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0005' AND OA.IN_OUT_DETAIL != '1007' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0005' AND OA.IN_OUT_DETAIL = '1007' AND XX.IN_OUT_TP = 'O'))	");
						}else if(hmCondition.get("h_vacation_type").equals("0004")) {
							sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0005'	AND OA.IN_OUT_DETAIL != '1007' AND XX.IN_OUT_TP = 'I' ");				
						}else if(hmCondition.get("h_vacation_type").equals("1006")) {
							sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0005'	AND OA.IN_OUT_DETAIL = '1007' AND XX.IN_OUT_TP = 'O' ");	
						}							
					}
				
					//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
				} else if (hmCondition.get("vacation_gubun").equals("2005")) {	//기타
					if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 기타휴가						
						sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0009' , '1011' , '2005' ) 	 				");
					}else if(hmCondition.get("vacation_detail").equals("EDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
						sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0009' AND OA.IN_OUT_DETAIL = '1011') OR (IA.IN_OUT_DETAIL = '2005' AND OA.IN_OUT_DETAIL = '2005')  ");
					}else if(hmCondition.get("vacation_detail").equals("EHD")) {   //반일휴가 
						if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
							sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0009' AND OA.IN_OUT_DETAIL != '1011' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0009' AND OA.IN_OUT_DETAIL = '1011' AND XX.IN_OUT_TP = 'O'))	");
						}else if(hmCondition.get("h_vacation_type").equals("0004")) {
							sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0009'	AND OA.IN_OUT_DETAIL != '1011' AND XX.IN_OUT_TP = 'I' ");					
						}else if(hmCondition.get("h_vacation_type").equals("1006")) {
							sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0009'	AND OA.IN_OUT_DETAIL = '1011' AND XX.IN_OUT_TP = 'O' ");
						}							
					}
				}
					
					//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
			} else {
					//sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN		('0005' , '1007' , '2003' , '2004' , '2005'  )	--// 				");
					sql.append("\r\n").append("					  AND (XX.IN_OUT_DETAIL  IN ( '0005' , '1007' ) OR XX.IN_OUT_DETAIL IN ( '2003' , '2004' , '2005'  ) AND XX.IN_OUT_TP = 'O')		");
				}
				
		}

		if(hmCondition.get("vacation_yn").equals("VCX")) {     //휴가여부가 미휴가이면,,
			sql.append("\r\n").append("		AND 	XX.IN_OUT_DETAIL IN		( '0001' , '0002' , '0003'  , '0006' , '1001' , '1002' , '1003' , '1004' , '1005' , '1008' )   ");
		}
		
		/**휴가조회 END**/			//휴가유형			sql.append("\r\n").append("					  /*조회조건 END*/																																						");
		sql.append("\r\n").append("					  																																										");
		sql.append("\r\n").append("			) Z																																												");
		sql.append("\r\n").append("			WHERE 1=1	  AND	ROWNUM BETWEEN " + start_row + " AND " + end_row 			);
		
					
		logger.info("------------------------------근태관리-관리자-근태확인44444 LIST START---------------------------------");
		logger.info(sql);
		logger.info("------------------------------근태관리-관리자-근태확인44444 LIST END---------------------------------");
		
		pstmt 	= con.prepareStatement(sql.toString());
		
		/**************************************************************************/
		//P A R A M E T E R		V A L U E S		S T A R T
		/**************************************************************************/
		/**************************************************************************/
		//P A R A M E T E R		V A L U E S		E   N   D
		/**************************************************************************/
		
		rs		= pstmt.executeQuery();
		
		System.out.println("근태조회55555<<<<<<<<<<<<<<<<<<<");			
		System.out.println(sql.toString());
		System.out.println("근태조회55555>>>>>>>>>>>>>>>>>>>");
		
		while (rs.next()) {
			
			HashMap<String , String>  hash_map = new HashMap<String, String>();
			
			hash_map.put("대소문자로 구분하여 사용할 것." , "디비에서는 상관없음.");
			
			//jsp에서 <s:property value='upper_dept_no'/> 와 같아야 함.
			hash_map.put("rownum" 				, rs.getString("ROWNUM") );				//ROWNUM
			hash_map.put("group_nm" 			, rs.getString("GROUP_NM") );			//그룹
			hash_map.put("group_nm_tt" 			, rs.getString("GROUP_NM_TT") );			//그룹
			hash_map.put("team_nm"				, rs.getString("TEAM_NM") );			//팀
			hash_map.put("aemp_no"				, rs.getString("EMP_NO") );				//사번	//aemp_no
			hash_map.put("emp_nm"				, rs.getString("EMP_NM") );				//성명
			hash_map.put("yyyymmdd"				, rs.getString("YYYYMMDD") );			//기준일
			hash_map.put("dayname"				, rs.getString("DAYNAME") );			//요일
			hash_map.put("in_out_tp"			, rs.getString("IN_OUT_TP") );			//출근일짜
			hash_map.put("in_out_tp_nm"			, rs.getString("IN_OUT_TP_NM") );			//출근일짜
			hash_map.put("in_out_dt"			, rs.getString("IN_OUT_DT"));			//출근일짜
			hash_map.put("in_out_time"			, rs.getString("IN_OUT_TIME") );		//출근시간
			hash_map.put("reg_ip"				, rs.getString("REG_IP") );				//입력된 IP
			hash_map.put("in_detail"			, rs.getString("IN_DETAIL") );		//퇴근ROW의 출근태상세 code	//2009-03-31
			hash_map.put("in_out_detail"		, rs.getString("IN_OUT_DETAIL") );		//근태상세 code
			hash_map.put("in_out_detail_nm"		, rs.getString("IN_OUT_DETAIL_NM") );	//근태상세
			hash_map.put("in_out_place_nm"		, rs.getString("IN_OUT_PLACE_NM") );	//
			hash_map.put("in_req_yn_nm"		    , rs.getString("IN_REQ_YN_NM") );
			hash_map.put("etc_emp"				, rs.getString("ETC_EMP") );			//입력자 비고
			hash_map.put("etc_emp_memo"			, rs.getString("ETC_EMP_MEMO") );			//입력자 비고
			hash_map.put("update_dt"			, rs.getString("UPDATE_DT") );			//확인시간
			hash_map.put("etc_mgr"				, rs.getString("ETC_MGR") );			//확인자 비고
			hash_map.put("approv_emp_no"		, rs.getString("APPROV_EMP_NO") );		//확인자 사번
			hash_map.put("approv_emp_nm"		, rs.getString("APPROV_EMP_NM") );		//확인자 성명
			hash_map.put("approv_emp_nm_tt"		, rs.getString("APPROV_EMP_NM_TT") );		//확인자 성명
			hash_map.put("mgr_change_yn"		, rs.getString("MGR_CHANGE_YN") );		//확인자 유형상세 변경여부
     		hash_map.put("confirm_yn"		    , rs.getString("CONFIRM_YN") );       ////////
			hash_map.put("close_dt"				, rs.getString("CLOSE_DT") );		//확인자 유형상세 변경여부
			hash_map.put("advantage"			, rs.getString("ADVANTAGE") );		//
			hash_map.put("advantage_nm"			, rs.getString("ADVANTAGE_NM") );		//휴가
			hash_map.put("req_yn"               , rs.getString("REQ_YN"));              //요청처리여부
			hash_map.put("req_detail"           , rs.getString("REQ_DETAIL"));           //유형상세
			
			list.add(hash_map);	// 한행의 데이터인 맵객체를 담는다.
			
		}
		
		if (hmCondition.get("confirm_yn").equals(CodeMetrix.NO) && list.size() == 0) {
			p_count	=	CodeMetrix.ZERO;
		} else {
			p_count =	list.size();
		}
		
	} catch (SQLException se) {
		se.printStackTrace();
		BaseException dex = new BaseException();                
		dex.setException(se);
		dex.setAppReturnCode("10");
		throw dex;
	} catch(Exception e) {
		BaseException dex = new BaseException();                
		dex.setException(e);
		dex.setAppReturnCode("20");
		throw dex;
	} finally {
		try {
			if (pstmt != null) pstmt.close();
			if (rs != null) rs.close();
			if(con != null) con.close();
			
		} catch(SQLException fse) {
			BaseException dex = new BaseException();                
			dex.setException(fse);
			dex.setAppReturnCode("10");
			throw dex;
		}
	}
}
	
	/**
	 * <pre>
	 * 근태관리-출퇴근확인-관리자- 결과 조회
	 * </pre>
	 * @throws BaseException
	 * @throws SQLException
	 */
	public void retireveAttendManagerList(HashMap<String, String> hmCondition , int start_row , int end_row , int emp_no) throws BaseException , SQLException {
		
		logger.info(hmCondition);
		con = super.getDataSource().getConnection();
		
		try {
			list = new ArrayList<HashMap<String,String>>();
			
			sql.setLength(0);
			
			sql.append("\r\n").append("			SELECT Z.*																																							");
			sql.append("\r\n").append("			FROM																																								");
			sql.append("\r\n").append("			(																																									");
			sql.append("\r\n").append("				SELECT  ROW_NUMBER() OVER( ORDER BY XX.YYYYMMDD DESC , XX.EMP_NO , XX.IN_OUT_TP , XX.GROUP_NO , XX.TEAM_NO ) ROWNUM,											");
			sql.append("\r\n").append("						CASE WHEN CHARINDEX('(' ,XX.GROUP_NM	) = 0 THEN XX.GROUP_NM ELSE SUBSTRING(XX.GROUP_NM , 1 , (CHARINDEX('(' ,XX.GROUP_NM	) - 1))	 END AS GROUP_NM			,		");
			sql.append("\r\n").append("						XX.GROUP_NM 	AS  GROUP_NM_TT			,																												");
			sql.append("\r\n").append("						XX.TEAM_NO				,																																");
			sql.append("\r\n").append("						XX.TEAM_NM				,																																");
			sql.append("\r\n").append("						XX.EMP_NO				,																																");
			sql.append("\r\n").append("						XX.EMP_NM				,																																");
			sql.append("\r\n").append("						XX.IN_OUT_DETAIL		,																																");
			sql.append("\r\n").append("						XX.IN_OUT_DETAIL_NM		,																																");
			sql.append("\r\n").append("						XX.IN_DETAIL			,																																");
			sql.append("\r\n").append("						XX.YYYYMMDD				,																																");
			sql.append("\r\n").append("						SUBSTRING(DATENAME(DW , CONVERT(SMALLDATETIME , XX.YYYYMMDD) ) ,1 ,1) AS  DAYNAME ,																		");
			sql.append("\r\n").append("						XX.IN_OUT_TP			,																																");
			sql.append("\r\n").append("						CASE WHEN XX.IN_OUT_TP = 'I' THEN  '출' ELSE '퇴' END IN_OUT_TP_NM 		,																				");
			sql.append("\r\n").append("						XX.IN_OUT_DT			,																																");
			sql.append("\r\n").append("						SUBSTRING(XX.IN_OUT_TIME,1,2) + ':' + SUBSTRING(XX.IN_OUT_TIME,3,4)	AS IN_OUT_TIME		,																");
			sql.append("\r\n").append("						XX.IN_OUT_PLACE			,																																");
			sql.append("\r\n").append("						C.CD_NM AS IN_OUT_PLACE_NM ,																															");
			sql.append("\r\n").append("						XX.ETC_EMP				,																																");
			sql.append("\r\n").append("						SUBSTRING(XX.ETC_EMP , 1 , 10) AS ETC_EMP_MEMO 	, 																										");
			sql.append("\r\n").append("						XX.ETC_MGR				,																																");
			sql.append("\r\n").append("						XX.REG_IP				,																																");
			sql.append("\r\n").append("						XX.MGR_CHANGE_YN		,																																");
			sql.append("\r\n").append("						XX.UPDATE_DT			,																																");
			sql.append("\r\n").append("						XX.APPROV_EMP_NO		,																																");
			sql.append("\r\n").append("						SUBSTRING(E.EMP_NM , 1, 3)	AS APPROV_EMP_NM		,																									");
			sql.append("\r\n").append("						E.EMP_NM 	AS APPROV_EMP_NM_TT		                ,																									");
			sql.append("\r\n").append("						XX.CONFIRM_YN			,																																");
			sql.append("\r\n").append("						XX.ADVANTAGE			,																																");
			sql.append("\r\n").append("						A_CD.ETC AS ADVANTAGE_NM,																																");
			sql.append("\r\n").append("						CASE WHEN (F.CLOSE_DT is null ) THEN 'N' ELSE 'Y' END  CLOSE_DT																							");
			sql.append("\r\n").append("				FROM																																							");
			sql.append("\r\n").append("				(																																								");
			sql.append("\r\n").append("						SELECT 																																					");
			sql.append("\r\n").append("								--ROW_NUMBER() OVER( ORDER BY IO.YYYYMMDD DESC , IO.EMP_NO , IO.IN_OUT_TP , VD.GROUP_NO , VD.TEAM_NO ) ROWNUM,									");
			sql.append("\r\n").append("								VD.GROUP_NO		,	VD.GROUP_NM,																												");
			sql.append("\r\n").append("								VD.TEAM_NO		,	VD.TEAM_NM,																													");
			sql.append("\r\n").append("								IO.EMP_NO		,	VD.EMP_NM,																													");
			sql.append("\r\n").append("								IO.IN_OUT_DETAIL,	IO.IN_OUT_DETAIL_NM,																										");
			sql.append("\r\n").append("								IO.IN_DETAIL	,																																");
			sql.append("\r\n").append("								IO.YYYYMMDD		,		IO.IN_OUT_TP,				--PK ROW																					");
			sql.append("\r\n").append("																																												");
			sql.append("\r\n").append("								IO.IN_OUT_DT,																																	");
			sql.append("\r\n").append("								IO.IN_OUT_TIME,																																	");
			sql.append("\r\n").append("																																												");
			sql.append("\r\n").append("								IO.IN_OUT_PLACE,																																");
			sql.append("\r\n").append("								IO.IN_OUT_PLACE_NM,																																");
			sql.append("\r\n").append("																																												");
			sql.append("\r\n").append("								IO.ETC_EMP,																																		");
			sql.append("\r\n").append("								IO.ETC_MGR,																																		");
			sql.append("\r\n").append("																																												");
			sql.append("\r\n").append("								IO.REG_IP,																																		");
			sql.append("\r\n").append("																																												");
			sql.append("\r\n").append("								IO.MGR_CHANGE_YN,																																");
			sql.append("\r\n").append("																																												");
			sql.append("\r\n").append("								IO.UPDATE_DT,																																	");
			sql.append("\r\n").append("								IO.APPROV_EMP_NO,																																");
			sql.append("\r\n").append("								IO.CONFIRM_YN,																																	");
			sql.append("\r\n").append("								IO.ADVANTAGE																																	");
			sql.append("\r\n").append("						FROM																																					");
			sql.append("\r\n").append("							(																																					");
			sql.append("\r\n").append("								SELECT  IO_CD.IN_OUT_DETAIL_NM ,																												");
			sql.append("\r\n").append("												IO_IN.*																															");
			sql.append("\r\n").append("								FROM 																																			");
			sql.append("\r\n").append("									(																																			");
			sql.append("\r\n").append("										--출퇴근유형																																");
			sql.append("\r\n").append("										SELECT A.YYYYMMDD , A.IN_OUT_TP , A.EMP_NO , A.IN_OUT_DETAIL, C.GROUP_CD, C.CD_NM AS IN_OUT_DETAIL_NM, C.ETC							");
			sql.append("\r\n").append("											FROM TB_ATTEND A, ( SELECT * FROM TB_COMM_CD WHERE ETC_CD IS NULL AND CD != '0' AND USE_YN = 'Y' ) C								");
			sql.append("\r\n").append("										WHERE A.IN_OUT_DETAIL = C.CD																											");
			sql.append("\r\n").append("									) IO_CD , 																																	");
			sql.append("\r\n").append("									(																																			");
			sql.append("\r\n").append("										--퇴근 ROW에 출근유형 추가																													");
			sql.append("\r\n").append("										SELECT 																																	");
			sql.append("\r\n").append("												AI.IN_OUT_DETAIL AS IN_DETAIL , A.*																								");
			sql.append("\r\n").append("										FROM 																																	");
			sql.append("\r\n").append("												TB_ATTEND A , 																													");
			sql.append("\r\n").append("												(SELECT YYYYMMDD , EMP_NO , IN_OUT_TP , IN_OUT_DETAIL  FROM TB_ATTEND WHERE IN_OUT_TP = 'I') AI									");
			sql.append("\r\n").append("										WHERE	--근태날짜와 사번만 조인																												");
			sql.append("\r\n").append("												A.YYYYMMDD = AI.YYYYMMDD 	--근태날짜																							");
			sql.append("\r\n").append("												AND 																																				");		
			sql.append("\r\n").append("												A.EMP_NO = AI.EMP_NO			--사번																												");
			sql.append("\r\n").append("												AND     A.YYYYMMDD   BETWEEN    REPLACE('"+hmCondition.get("s_date")+"' , '-' , '')  AND    REPLACE('"+hmCondition.get("e_date")+"' , '-' , '')		");
			sql.append("\r\n").append("									) IO_IN																																							");
			sql.append("\r\n").append("								WHERE	IO_CD.YYYYMMDD = IO_IN.YYYYMMDD																																");
			sql.append("\r\n").append("										AND																																							");
			sql.append("\r\n").append("										IO_CD.EMP_NO = IO_IN.EMP_NO																																	");
			sql.append("\r\n").append("										AND 																																						");
			sql.append("\r\n").append("										IO_CD.IN_OUT_TP = IO_IN.IN_OUT_TP																															");
			sql.append("\r\n").append("							) IO ,																																									");
			sql.append("\r\n").append("							V_DEPT	VD																																								");
			sql.append("\r\n").append("							WHERE IO.EMP_NO = VD.EMP_NO	AND 	VD.EMP_NO != 	"+emp_no+"																											");
			sql.append("\r\n").append("					) XX LEFT OUTER JOIN TB_COMM_CD 	C 		ON 	XX.IN_OUT_PLACE 	= 	C.CD 			--출퇴근지명칭 																			");
			sql.append("\r\n").append("					LEFT JOIN TB_COMM_CD 				A_CD 	ON 	XX.ADVANTAGE 		= 	A_CD.CD			--휴가반영 																				");
			sql.append("\r\n").append("					LEFT JOIN TB_EMP 					E 		ON 	XX.APPROV_EMP_NO 	= 	E.EMP_NO		--확인자 																					");
			sql.append("\r\n").append("					LEFT JOIN TB_ATTEND_CLOSE 			F 		ON  XX.YYYYMMDD 		=	F.CLOSE_DT		--마감여부 																				");
			sql.append("\r\n").append("					     JOIN TB_AUTH_DEPT 				AZ 		ON 	XX.TEAM_NO 			= 	AZ.DEPT_NO 	 	AND 	AZ.EMP_NO =	"+emp_no+" 															");
			sql.append("\r\n").append("																																																	");
			sql.append("\r\n").append("					/*출근유형 AND 퇴근유형 START*/																																						");
			
			sql.append("\r\n").append("						 JOIN TB_ATTEND				IA		ON  XX.YYYYMMDD			=	IA.YYYYMMDD	AND XX.EMP_NO = IA.EMP_NO	AND IA.IN_OUT_TP = 'I'	");
			
			//결근이 선택되지 않았을 경우
		    if (!hmCondition.get("absence_type").equals(CodeMetrix.NN) ) {
		    	//출근상세
		    	if (!hmCondition.get("chk_in_type").equals(CodeMetrix.ALL)) {
	        		sql.append("\r\n").append("						 AND IA.IN_OUT_DETAIL = '"+hmCondition.get("chk_in_type")+"'				");
	        	}
		    	
		    }
		    
			sql.append("\r\n").append("						 JOIN TB_ATTEND				OA		ON  XX.YYYYMMDD			=   OA.YYYYMMDD AND XX.EMP_NO = OA.EMP_NO	AND OA.IN_OUT_TP = 'O'	");
			
			//결근이 선택되지 않았을 경우
		    if (!hmCondition.get("absence_type").equals(CodeMetrix.NN) ) {
		    	if (!hmCondition.get("chk_out_type").equals(CodeMetrix.ALL)) {
	        		sql.append("\r\n").append("						 AND OA.IN_OUT_DETAIL = '"+hmCondition.get("chk_out_type")+"'			");
		    	} 
		    	
		    }
			
			sql.append("\r\n").append("					/*출근유형 AND 퇴근유형 END*/																																						");
			sql.append("\r\n").append("																																																	");
			sql.append("\r\n").append("				WHERE 1	=	1																																										");
			sql.append("\r\n").append("					  /*조회조건 START*/																																								");
			sql.append("\r\n").append("					  AND	GROUP_NO 	LIKE	REPLACE('"+hmCondition.get("sgroup")+"' , 'ALL' , '%')		--	그룹																					");
			sql.append("\r\n").append("					  AND 	TEAM_NO		LIKE	REPLACE('"+hmCondition.get("steam")+"' , 'ALL' , '%')		--	팀																						");
			//sql.append("\r\n").append("					  AND 	XX.EMP_NO	LIKE	REPLACE('"+hmCondition.get("semp_no")+"' , 'ALL' , '%')																								");
			
			/**특근조회 S T A R T**/
		    if (hmCondition.get("sp_work_type").equals("SWO")) {
		    	
		    	if (hmCondition.get("sp_work_gubun").equals(CodeMetrix.ALL)) {
		    		
		    		sql.append("\r\n").append("					  AND (	IA.IN_OUT_DETAIL IN	(	'0006'	) 																");
		    		sql.append("\r\n").append("					  OR 	OA.IN_OUT_DETAIL IN	(	'1005'	,	'1008' 	) 		)											");
		    	} else if (hmCondition.get("sp_work_gubun").equals("1005")) {	//철야
		    		sql.append("\r\n").append("					  AND 	OA.IN_OUT_DETAIL =		'"+hmCondition.get("sp_work_gubun")+"' 					 				");
		    	} else if (hmCondition.get("sp_work_gubun").equals("0006")) {	//
					sql.append("\r\n").append("					  AND 	IA.IN_OUT_DETAIL =		'"+hmCondition.get("sp_work_gubun")+"' 					 				");
				}
		    	
		    } else if (hmCondition.get("sp_work_type").equals("SWX")) {
		    	sql.append("\r\n").append("					  AND (	IA.IN_OUT_DETAIL !=	'0006'	 																");
		    	sql.append("\r\n").append("					  AND 	OA.IN_OUT_DETAIL NOT	IN	(	'1005' ,	'1008' 	) 		)											");
		    }
		    /**특근조회 E   N   D**/
			
		    //추가 휴가반영 검색조건
		    if (hmCondition.get("addVacation").equals("AVO")) {
		    	if (hmCondition.get("addVacation_gubun").equals(CodeMetrix.ALL)) {
		    		sql.append("\r\n").append("						AND     OA.ADVANTAGE             IN   ( '3302' , '3303' )		--반일 + 일일휴가																			");
		    	} else {
		    		sql.append("\r\n").append("						AND     OA.ADVANTAGE             =   '"+hmCondition.get("addVacation_gubun")+"'						");
		    	}
		    } else	if (hmCondition.get("addVacation").equals("AVX")) {
		    	sql.append("\r\n").append("						AND    ( OA.ADVANTAGE             =    '3301' OR LEN(OA.ADVANTAGE) = 0 OR OA.ADVANTAGE = '' )		--반일 + 일일휴가											");
		    }			
		    
			//사번이 ALL인 경우에 쿼리에서 제외한다.
			if (!hmCondition.get("semp_no").equals(CodeMetrix.ALL) &&  hmCondition.get("searchEmpNm").equals("")) {
				sql.append("\r\n").append("					  AND     XX.EMP_NO                    =   '"+hmCondition.get("semp_no")+"'                    																				");
			} else
			
			//사원검색일 경우 추가됨
			if ( (hmCondition.get("semp_no").equals(CodeMetrix.ALL) || hmCondition.get("semp_no").equals("")) &&  !hmCondition.get("searchEmpNm").equals("")) {
				sql.append("\r\n").append("					  AND     XX.EMP_NM                    LIKE    '"+hmCondition.get("searchEmpNm")+"%'                   																		");
			}
			
			//확인여부가 ALL인경우 쿼리에서 제외시킴
			if (!hmCondition.get("confirm_yn").equals(CodeMetrix.ALL)) {
				sql.append("\r\n").append("					  AND     XX.CONFIRM_YN                =   '"+hmCondition.get("confirm_yn")+"' --확인여부																						");
			}
			
			//관리자 변경 여부가 ALL이 아닌경우 쿼리에서 제외시킴
			if (!hmCondition.get("mgr_change_yn").equals(CodeMetrix.ALL)) {
				sql.append("\r\n").append("					  AND     XX.MGR_CHANGE_YN             =   '" + hmCondition.get("mgr_change_yn") + "'  --CASE ? WHEN 'ALL' THEN '%' ELSE THEN ? END											");
			}
			
			sql.append("\r\n").append("					  AND   XX.IN_OUT_TP LIKE  	REPLACE('" + hmCondition.get("in_out_tp_condi") + "' , 'ALL' , '%')			--출퇴근분류 																");
			
			//결근
		    if (hmCondition.get("absence_type").equals(CodeMetrix.NN) ) {
//		    	sql.append("\r\n").append("				AND	  XX.IN_OUT_DETAIL = '"+hmCondition.get("absence_type")+"'   --결근																											");
		    	sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL LIKE	REPLACE('"+hmCondition.get("absence_type")+"' , 'ALL' , '%')	--출퇴근유형상세 																");
		    }
		    
		    /**휴가조회 START**/
			if(hmCondition.get("vacation_yn").equals("VCO")) {     //휴가여부가 휴가이면,,
							
				if (hmCondition.get("vacation_type").equals(CodeMetrix.ALL)) {  //모든 휴가
					sql.append("\r\n").append("	 AND 	XX.IN_OUT_DETAIL IN ( '0004' , '0005' , '0007' , '0008' , '0009' , '1006' , '1007' , '1009' , '1010' , '1011' , '2001' , '2002' , '2003' , '2004' , '2005'  ) 	");
					
				}else if (hmCondition.get("vacation_type").equals("VSO")) {		//연차관련
					
					if (hmCondition.get("vacation_gubun").equals(CodeMetrix.ALL)) { //모든 연차관련휴가(연차 + 특별)
						sql.append("\r\n").append("					  AND XX.IN_OUT_DETAIL  IN ( '0004' , '1006' , '2001' , '0007' , '1009' , '2002'  )	");
						
					} else if (hmCondition.get("vacation_gubun").equals("2001")) {	//연차						
						if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 연차휴가						
							sql.append("\r\n").append("			 AND 	XX.IN_OUT_DETAIL IN ( '0004' , '1006' , '2001' ) 	 ");
						}else if(hmCondition.get("vacation_detail").equals("HDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
							sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0004' AND OA.IN_OUT_DETAIL = '1006') OR (IA.IN_OUT_DETAIL = '2001' AND OA.IN_OUT_DETAIL = '2001')  ");
						}else if(hmCondition.get("vacation_detail").equals("HHD")) {   //반일휴가 
							if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
								sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0004' AND OA.IN_OUT_DETAIL != '1006' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0004' AND OA.IN_OUT_DETAIL = '1006' AND XX.IN_OUT_TP = 'O'))	");
							}else if(hmCondition.get("h_vacation_type").equals("0004")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0004'	AND OA.IN_OUT_DETAIL != '1006' AND XX.IN_OUT_TP = 'I' ");					
							}else if(hmCondition.get("h_vacation_type").equals("1006")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0004'	AND OA.IN_OUT_DETAIL = '1006' AND XX.IN_OUT_TP = 'O' ");								
							}
						}
						//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");

					} else if (hmCondition.get("vacation_gubun").equals("2002")) {	//특별
						if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 특별휴가						
							sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0007' , '1009' , '2002' ) 	 				");
						}else if(hmCondition.get("vacation_detail").equals("SDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
							sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0007' AND OA.IN_OUT_DETAIL = '1009') OR (IA.IN_OUT_DETAIL = '2002' AND OA.IN_OUT_DETAIL = '2002')  ");
						}else if(hmCondition.get("vacation_detail").equals("SHD")) {   //반일휴가 
							if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
								sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0007' AND OA.IN_OUT_DETAIL != '1009' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0007' AND OA.IN_OUT_DETAIL = '1009' AND XX.IN_OUT_TP = 'O'))	");
							}else if(hmCondition.get("h_vacation_type").equals("0004")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0007'	AND OA.IN_OUT_DETAIL != '1009' AND XX.IN_OUT_TP = 'I' ");				
							}else if(hmCondition.get("h_vacation_type").equals("1006")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0007'	AND OA.IN_OUT_DETAIL = '1009' AND XX.IN_OUT_TP = 'O' ");								
							}
						}
						//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
						
					} //else if (hmCondition.get("vacation_gubun").equals("HFV")) {	//반일연차
						//if (hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
						//	sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN		( '0004' , '1006' ) 	--// 													");
							
						//} else if (hmCondition.get("h_vacation_type").equals("0004")) {
						//	sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL =		'"+hmCondition.get("h_vacation_type")+"'  	--// 				");
						//} else if (hmCondition.get("h_vacation_type").equals("1006")) {
						//	sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL =		 '"+hmCondition.get("h_vacation_type")+"'  	--// 				");
						//}
						
					//}
				}else if (hmCondition.get("vacation_type").equals("VSX")) {		//연차외
					
					//if (hmCondition.get("vacation_gubun").equals("HFO")) {	//반일공가
						
					//	if (hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
					//		sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN		( '0005' , '1007' ) 	--// 									");
					//	} else {
					//		sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL =		'"+hmCondition.get("h_vacation_type")+"'  	--// 				");
					//	}
					//} 
					//else 
					if (hmCondition.get("vacation_gubun").equals(CodeMetrix.ALL)) {	// 모든 연차외 휴가(경조+공가+기타)
						sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0005' , '1007' , '2004' , '0008' , '1010' , '2003' , '0009' , '1011' , '2005'  )   			");
						//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
					} else if (hmCondition.get("vacation_gubun").equals("2003")) {	//경조
						if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 경조휴가						
							sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0008' , '1010' , '2003' ) 	 				");
						}else if(hmCondition.get("vacation_detail").equals("FDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
							sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0008' AND OA.IN_OUT_DETAIL = '1010') OR (IA.IN_OUT_DETAIL = '2003' AND OA.IN_OUT_DETAIL = '2003')  ");
						}else if(hmCondition.get("vacation_detail").equals("FHD")) {   //반일휴가 
							if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
								sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0008' AND OA.IN_OUT_DETAIL != '1010' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0008' AND OA.IN_OUT_DETAIL = '1010' AND XX.IN_OUT_TP = 'O'))	");
							}else if(hmCondition.get("h_vacation_type").equals("0004")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0008'	AND OA.IN_OUT_DETAIL != '1010' AND XX.IN_OUT_TP = 'I' ");				
							}else if(hmCondition.get("h_vacation_type").equals("1006")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0008'	AND OA.IN_OUT_DETAIL = '1010' AND XX.IN_OUT_TP = 'O' ");						
							}
						}
						
					
						//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
					} else if (hmCondition.get("vacation_gubun").equals("2004")) {	//공가
						if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 공가					
							sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0005' , '1007' , '2004' ) 	 				");
						}else if(hmCondition.get("vacation_detail").equals("GDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
							sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0005' AND OA.IN_OUT_DETAIL = '1007') OR (IA.IN_OUT_DETAIL = '2004' AND OA.IN_OUT_DETAIL = '2004')  ");
						}else if(hmCondition.get("vacation_detail").equals("GHD")) {   //반일휴가 
							if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
								sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0005' AND OA.IN_OUT_DETAIL != '1007' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0005' AND OA.IN_OUT_DETAIL = '1007' AND XX.IN_OUT_TP = 'O'))	");
							}else if(hmCondition.get("h_vacation_type").equals("0004")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0005'	AND OA.IN_OUT_DETAIL != '1007' AND XX.IN_OUT_TP = 'I' ");				
							}else if(hmCondition.get("h_vacation_type").equals("1006")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0005'	AND OA.IN_OUT_DETAIL = '1007' AND XX.IN_OUT_TP = 'O' ");	
							}							
						}
					
						//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
					} else if (hmCondition.get("vacation_gubun").equals("2005")) {	//기타
						if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 기타휴가						
							sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0009' , '1011' , '2005' ) 	 				");
						}else if(hmCondition.get("vacation_detail").equals("EDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
							sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0009' AND OA.IN_OUT_DETAIL = '1011') OR (IA.IN_OUT_DETAIL = '2005' AND OA.IN_OUT_DETAIL = '2005')  ");
						}else if(hmCondition.get("vacation_detail").equals("EHD")) {   //반일휴가 
							if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
								sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0009' AND OA.IN_OUT_DETAIL != '1011' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0009' AND OA.IN_OUT_DETAIL = '1011' AND XX.IN_OUT_TP = 'O'))	");
							}else if(hmCondition.get("h_vacation_type").equals("0004")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0009'	AND OA.IN_OUT_DETAIL != '1011' AND XX.IN_OUT_TP = 'I' ");					
							}else if(hmCondition.get("h_vacation_type").equals("1006")) {
								sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0009'	AND OA.IN_OUT_DETAIL = '1011' AND XX.IN_OUT_TP = 'O' ");
							}							
						}
					}
						
						//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
				} else {
						//sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN		('0005' , '1007' , '2003' , '2004' , '2005'  )	--// 				");
						sql.append("\r\n").append("					  AND (XX.IN_OUT_DETAIL  IN ( '0005' , '1007' ) OR XX.IN_OUT_DETAIL IN ( '2003' , '2004' , '2005'  ) AND XX.IN_OUT_TP = 'O')		");
					}
					
			}

			if(hmCondition.get("vacation_yn").equals("VCX")) {     //휴가여부가 미휴가이면,,
				sql.append("\r\n").append("		AND 	XX.IN_OUT_DETAIL IN		( '0001' , '0002' , '0003'  , '0006' , '1001' , '1002' , '1003' , '1004' , '1005' , '1008' )   ");
			}
			
			/**휴가조회 END**/			//휴가유형			sql.append("\r\n").append("					  /*조회조건 END*/																																						");
			sql.append("\r\n").append("					  																																										");
			sql.append("\r\n").append("			) Z																																												");
			sql.append("\r\n").append("			WHERE 1=1	  AND	ROWNUM BETWEEN " + start_row + " AND " + end_row 			);

			
			System.out.println("======================================66666\r\n");
			System.out.println("--근태관리-관리자-근태확인 LIST666666\r\n" + sql.toString());
			System.out.println("======================================666666\r\n");
            
            logger.info("------------------------------근태관리-관리자-근태확인77777 LIST START---------------------------------");
            logger.info(sql);
            logger.info("------------------------------근태관리-관리자-근태확인77777 LIST END---------------------------------");
			
			pstmt 	= con.prepareStatement(sql.toString());
			
			/**************************************************************************/
			//P A R A M E T E R		V A L U E S		S T A R T
			/**************************************************************************/
			/**************************************************************************/
			//P A R A M E T E R		V A L U E S		E   N   D
			/**************************************************************************/
			
			rs		= pstmt.executeQuery();
			
			while (rs.next()) {
				
				HashMap<String , String>  hash_map = new HashMap<String, String>();
				
				hash_map.put("대소문자로 구분하여 사용할 것." , "디비에서는 상관없음.");
				
				//jsp에서 <s:property value='upper_dept_no'/> 와 같아야 함.
				hash_map.put("rownum" 				, rs.getString("ROWNUM") );				//ROWNUM
				hash_map.put("group_nm" 			, rs.getString("GROUP_NM") );			//그룹
				hash_map.put("group_nm_tt" 			, rs.getString("GROUP_NM_TT") );			//그룹
				hash_map.put("team_nm"				, rs.getString("TEAM_NM") );			//팀
				hash_map.put("aemp_no"				, rs.getString("EMP_NO") );				//사번	//aemp_no
				hash_map.put("emp_nm"				, rs.getString("EMP_NM") );				//성명
				hash_map.put("yyyymmdd"				, rs.getString("YYYYMMDD") );			//기준일
				hash_map.put("dayname"				, rs.getString("DAYNAME") );			//요일
				hash_map.put("in_out_tp"			, rs.getString("IN_OUT_TP") );			//출근일짜
				hash_map.put("in_out_tp_nm"			, rs.getString("IN_OUT_TP_NM") );			//출근일짜
				hash_map.put("in_out_dt"			, rs.getString("IN_OUT_DT") );			//출근일짜
				hash_map.put("in_out_time"			, rs.getString("IN_OUT_TIME") );		//출근시간
				hash_map.put("reg_ip"				, rs.getString("REG_IP") );				//입력된 IP
				hash_map.put("in_detail"			, rs.getString("IN_DETAIL") );		//퇴근ROW의 출근태상세 code	//2009-03-31
				hash_map.put("in_out_detail"		, rs.getString("IN_OUT_DETAIL") );		//근태상세 code
				hash_map.put("in_out_detail_nm"		, rs.getString("IN_OUT_DETAIL_NM") );	//근태상세
				hash_map.put("in_out_place_nm"		, rs.getString("IN_OUT_PLACE_NM") );	//
				hash_map.put("etc_emp"				, rs.getString("ETC_EMP") );			//입력자 비고
				hash_map.put("etc_emp_memo"			, rs.getString("ETC_EMP_MEMO") );			//입력자 비고
				hash_map.put("update_dt"			, rs.getString("UPDATE_DT") );			//확인시간
				hash_map.put("etc_mgr"				, rs.getString("ETC_MGR") );			//확인자 비고
				hash_map.put("approv_emp_no"		, rs.getString("APPROV_EMP_NO") );		//확인자 사번
				hash_map.put("approv_emp_nm"		, rs.getString("APPROV_EMP_NM") );		//확인자 성명
				hash_map.put("approv_emp_nm_tt"		, rs.getString("APPROV_EMP_NM_TT") );		//확인자 성명
				hash_map.put("mgr_change_yn"		, rs.getString("MGR_CHANGE_YN") );		//확인자 유형상세 변경여부
				hash_map.put("close_dt"				, rs.getString("CLOSE_DT") );		//확인자 유형상세 변경여부
				hash_map.put("advantage"			, rs.getString("ADVANTAGE") );		//
				hash_map.put("advantage_nm"			, rs.getString("ADVANTAGE_NM") );		//휴가

				list.add(hash_map);	// 한행의 데이터인 맵객체를 담는다.
				
			}
			
			if (hmCondition.get("confirm_yn").equals(CodeMetrix.NO) && list.size() == 0) {
				p_count	=	CodeMetrix.ZERO;
			} else {
				p_count =	list.size();
			}
						
		} catch (SQLException se) {
			se.printStackTrace();
			BaseException dex = new BaseException();                
			dex.setException(se);
			dex.setAppReturnCode("10");
			throw dex;
		} catch(Exception e) {
			BaseException dex = new BaseException();                
			dex.setException(e);
			dex.setAppReturnCode("20");
			throw dex;
		} finally {
			try {
				if (pstmt != null) pstmt.close();
				if (rs != null) rs.close();
				if(con != null) con.close();

			} catch(SQLException fse) {
				BaseException dex = new BaseException();                
				dex.setException(fse);
				dex.setAppReturnCode("10");
				throw dex;
			}
		}
	}
	
public void retireveAttendManagerList_2(HashMap<String, String> hmCondition , int start_row , int end_row , int emp_no) throws BaseException , SQLException {
		
	logger.info(hmCondition);
	con = super.getDataSource().getConnection();
	
	try {
		list = new ArrayList<HashMap<String,String>>();
		
		sql.setLength(0);
		
		sql.append("\r\n").append("			SELECT Z.*																																							");
		sql.append("\r\n").append("			FROM																																								");
		sql.append("\r\n").append("			(																																									");
		sql.append("\r\n").append("				SELECT  ROW_NUMBER() OVER( ORDER BY XX.YYYYMMDD DESC , XX.EMP_NO , XX.IN_OUT_TP , XX.GROUP_NO , XX.TEAM_NO ) ROWNUM,											");
		sql.append("\r\n").append("						CASE WHEN CHARINDEX('(' ,XX.GROUP_NM	) = 0 THEN XX.GROUP_NM ELSE SUBSTRING(XX.GROUP_NM , 1 , (CHARINDEX('(' ,XX.GROUP_NM	) - 1))	 END AS GROUP_NM			,		");
		sql.append("\r\n").append("						XX.GROUP_NM 	AS  GROUP_NM_TT			,																												");
		sql.append("\r\n").append("						XX.TEAM_NO				,																																");
		sql.append("\r\n").append("						XX.TEAM_NM				,																																");
		sql.append("\r\n").append("						XX.EMP_NO				,																																");
		sql.append("\r\n").append("						XX.EMP_NM				,																																");
		sql.append("\r\n").append("						XX.IN_OUT_DETAIL		,																																");
		sql.append("\r\n").append("						XX.IN_OUT_DETAIL_NM		,																																");
		sql.append("\r\n").append("						XX.IN_DETAIL			,																																");
		sql.append("\r\n").append("						XX.YYYYMMDD				,																																");
		sql.append("\r\n").append("						SUBSTRING(DATENAME(DW , CONVERT(SMALLDATETIME , XX.YYYYMMDD) ) ,1 ,1) AS  DAYNAME ,																		");
		sql.append("\r\n").append("						XX.IN_OUT_TP			,																																");
		sql.append("\r\n").append("						CASE WHEN XX.IN_OUT_TP = 'I' THEN  '출' ELSE '퇴' END IN_OUT_TP_NM 		,																				");
		sql.append("\r\n").append("						XX.IN_OUT_DT			,																																");
		sql.append("\r\n").append("						SUBSTRING(XX.IN_OUT_TIME,1,2) + ':' + SUBSTRING(XX.IN_OUT_TIME,3,4)	AS IN_OUT_TIME		,																");
		sql.append("\r\n").append("						XX.IN_OUT_PLACE			,																																");
		sql.append("\r\n").append("						C.CD_NM AS IN_OUT_PLACE_NM ,																															");
		sql.append("\r\n").append("						XX.ETC_EMP				,																																");
		sql.append("\r\n").append("						SUBSTRING(XX.ETC_EMP , 1 , 10) AS ETC_EMP_MEMO 	, 																										");
		sql.append("\r\n").append("						XX.ETC_MGR				,																																");
		sql.append("\r\n").append("						XX.REG_IP				,																																");
		sql.append("\r\n").append("						XX.MGR_CHANGE_YN		,																																");
		sql.append("\r\n").append("						XX.UPDATE_DT			,																																");
		sql.append("\r\n").append("						XX.APPROV_EMP_NO		,																																");
		sql.append("\r\n").append("						SUBSTRING(E.EMP_NM , 1, 3)	AS APPROV_EMP_NM		,																									");
		sql.append("\r\n").append("						E.EMP_NM 	AS APPROV_EMP_NM_TT		                ,																									");
		sql.append("\r\n").append("						XX.CONFIRM_YN			,																																");
		sql.append("\r\n").append("						XX.ADVANTAGE			,																																");
		sql.append("\r\n").append("						A_CD.ETC AS ADVANTAGE_NM,																																");
		sql.append("\r\n").append("						CASE WHEN (F.CLOSE_DT is null ) THEN 'N' ELSE 'Y' END  CLOSE_DT																							");
		sql.append("\r\n").append("				FROM																																							");
		sql.append("\r\n").append("				(																																								");
		sql.append("\r\n").append("						SELECT 																																					");
		sql.append("\r\n").append("								--ROW_NUMBER() OVER( ORDER BY IO.YYYYMMDD DESC , IO.EMP_NO , IO.IN_OUT_TP , VD.GROUP_NO , VD.TEAM_NO ) ROWNUM,									");
		sql.append("\r\n").append("								VD.GROUP_NO		,	VD.GROUP_NM,																												");
		sql.append("\r\n").append("								VD.TEAM_NO		,	VD.TEAM_NM,																													");
		sql.append("\r\n").append("								IO.EMP_NO		,	VD.EMP_NM,																													");
		sql.append("\r\n").append("								IO.IN_OUT_DETAIL,	IO.IN_OUT_DETAIL_NM,																										");
		sql.append("\r\n").append("								IO.IN_DETAIL	,																																");
		sql.append("\r\n").append("								IO.YYYYMMDD		,		IO.IN_OUT_TP,				--PK ROW																					");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.IN_OUT_DT,																																	");
		sql.append("\r\n").append("								IO.IN_OUT_TIME,																																	");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.IN_OUT_PLACE,																																");
		sql.append("\r\n").append("								IO.IN_OUT_PLACE_NM,																																");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.ETC_EMP,																																		");
		sql.append("\r\n").append("								IO.ETC_MGR,																																		");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.REG_IP,																																		");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.MGR_CHANGE_YN,																																");
		sql.append("\r\n").append("																																												");
		sql.append("\r\n").append("								IO.UPDATE_DT,																																	");
		sql.append("\r\n").append("								IO.APPROV_EMP_NO,																																");
		sql.append("\r\n").append("								IO.CONFIRM_YN,																																	");
		sql.append("\r\n").append("								IO.ADVANTAGE																																	");
		sql.append("\r\n").append("						FROM																																					");
		sql.append("\r\n").append("							(																																					");
		sql.append("\r\n").append("								SELECT  IO_CD.IN_OUT_DETAIL_NM ,																												");
		sql.append("\r\n").append("												IO_IN.*																															");
		sql.append("\r\n").append("								FROM 																																			");
		sql.append("\r\n").append("									(																																			");
		sql.append("\r\n").append("										--출퇴근유형																																");
		sql.append("\r\n").append("										SELECT A.YYYYMMDD , A.IN_OUT_TP , A.EMP_NO , A.IN_OUT_DETAIL, C.GROUP_CD, C.CD_NM AS IN_OUT_DETAIL_NM, C.ETC							");
		sql.append("\r\n").append("											FROM TB_ATTEND A, ( SELECT * FROM TB_COMM_CD WHERE ETC_CD IS NULL AND CD != '0' AND USE_YN = 'Y' ) C								");
		sql.append("\r\n").append("										WHERE A.IN_OUT_DETAIL = C.CD																											");
		sql.append("\r\n").append("									) IO_CD , 																																	");
		sql.append("\r\n").append("									(																																			");
		sql.append("\r\n").append("										--퇴근 ROW에 출근유형 추가																													");
		sql.append("\r\n").append("										SELECT 																																	");
		sql.append("\r\n").append("												AI.IN_OUT_DETAIL AS IN_DETAIL , A.*																								");
		sql.append("\r\n").append("										FROM 																																	");
		sql.append("\r\n").append("												TB_ATTEND A , 																													");
		sql.append("\r\n").append("												(SELECT YYYYMMDD , EMP_NO , IN_OUT_TP , IN_OUT_DETAIL  FROM TB_ATTEND WHERE IN_OUT_TP = 'I') AI									");
		sql.append("\r\n").append("										WHERE	--근태날짜와 사번만 조인																												");
		sql.append("\r\n").append("												A.YYYYMMDD = AI.YYYYMMDD 	--근태날짜																							");
		sql.append("\r\n").append("												AND 																																				");		
		sql.append("\r\n").append("												A.EMP_NO = AI.EMP_NO			--사번																												");
		sql.append("\r\n").append("												AND     A.YYYYMMDD   BETWEEN    REPLACE('"+hmCondition.get("s_date")+"' , '-' , '')  AND    REPLACE('"+hmCondition.get("e_date")+"' , '-' , '')		");
		sql.append("\r\n").append("									) IO_IN																																							");
		sql.append("\r\n").append("								WHERE	IO_CD.YYYYMMDD = IO_IN.YYYYMMDD																																");
		sql.append("\r\n").append("										AND																																							");
		sql.append("\r\n").append("										IO_CD.EMP_NO = IO_IN.EMP_NO																																	");
		sql.append("\r\n").append("										AND 																																						");
		sql.append("\r\n").append("										IO_CD.IN_OUT_TP = IO_IN.IN_OUT_TP																															");
		sql.append("\r\n").append("							) IO ,																																									");
		sql.append("\r\n").append("							V_DEPT	VD																																								");
		sql.append("\r\n").append("							WHERE IO.EMP_NO = VD.EMP_NO	AND 	VD.EMP_NO = 	"+emp_no+"																											");
		sql.append("\r\n").append("					) XX LEFT OUTER JOIN TB_COMM_CD 	C 		ON 	XX.IN_OUT_PLACE 	= 	C.CD 			--출퇴근지명칭 																			");
		sql.append("\r\n").append("					LEFT JOIN TB_COMM_CD 				A_CD 	ON 	XX.ADVANTAGE 		= 	A_CD.CD			--휴가반영 																				");
		sql.append("\r\n").append("					LEFT JOIN TB_EMP 					E 		ON 	XX.APPROV_EMP_NO 	= 	E.EMP_NO		--확인자 																					");
		sql.append("\r\n").append("					LEFT JOIN TB_ATTEND_CLOSE 			F 		ON  XX.YYYYMMDD 		=	F.CLOSE_DT		--마감여부 																				");
		sql.append("\r\n").append("					--     JOIN TB_AUTH_DEPT 				AZ 		ON 	XX.TEAM_NO 			= 	AZ.DEPT_NO 	 	AND 	AZ.EMP_NO =	"+emp_no+" 															");
		sql.append("\r\n").append("																																																	");
		sql.append("\r\n").append("					/*출근유형 AND 퇴근유형 START*/																																						");
		
		sql.append("\r\n").append("						 JOIN TB_ATTEND				IA		ON  XX.YYYYMMDD			=	IA.YYYYMMDD	AND XX.EMP_NO = IA.EMP_NO	AND IA.IN_OUT_TP = 'I'	");
		
		//결근이 선택되지 않았을 경우
		if (!hmCondition.get("absence_type").equals(CodeMetrix.NN) ) {
			//출근상세
			if (!hmCondition.get("chk_in_type").equals(CodeMetrix.ALL)) {
				sql.append("\r\n").append("						 AND IA.IN_OUT_DETAIL = '"+hmCondition.get("chk_in_type")+"'				");
			}
			
		}
		
		sql.append("\r\n").append("						 JOIN TB_ATTEND				OA		ON  XX.YYYYMMDD			=   OA.YYYYMMDD AND XX.EMP_NO = OA.EMP_NO	AND OA.IN_OUT_TP = 'O'	");
		
		//결근이 선택되지 않았을 경우
		if (!hmCondition.get("absence_type").equals(CodeMetrix.NN) ) {
			if (!hmCondition.get("chk_out_type").equals(CodeMetrix.ALL)) {
				sql.append("\r\n").append("						 AND OA.IN_OUT_DETAIL = '"+hmCondition.get("chk_out_type")+"'			");
			} 
			
		}
		
		sql.append("\r\n").append("					/*출근유형 AND 퇴근유형 END*/																																						");
		sql.append("\r\n").append("																																																	");
		sql.append("\r\n").append("				WHERE 1	=	1																																										");
		sql.append("\r\n").append("					  /*조회조건 START*/																																								");
		sql.append("\r\n").append("					  --AND	GROUP_NO 	LIKE	REPLACE('"+hmCondition.get("sgroup")+"' , 'ALL' , '%')		--	그룹																					");
		sql.append("\r\n").append("					  --AND 	TEAM_NO		LIKE	REPLACE('"+hmCondition.get("steam")+"' , 'ALL' , '%')		--	팀																						");
		//sql.append("\r\n").append("					  AND 	XX.EMP_NO	LIKE	REPLACE('"+hmCondition.get("semp_no")+"' , 'ALL' , '%')																								");
		
		/**특근조회 S T A R T**/
		if (hmCondition.get("sp_work_type").equals("SWO")) {
			
			if (hmCondition.get("sp_work_gubun").equals(CodeMetrix.ALL)) {
				
				sql.append("\r\n").append("					  AND (	IA.IN_OUT_DETAIL IN	(	'0006'	) 																");
				sql.append("\r\n").append("					  OR 	OA.IN_OUT_DETAIL IN	(	'1005'	,	'1008' 	) 		)											");
			} else if (hmCondition.get("sp_work_gubun").equals("1005")) {	//철야
				sql.append("\r\n").append("					  AND 	OA.IN_OUT_DETAIL =		'"+hmCondition.get("sp_work_gubun")+"' 					 				");
			} else if (hmCondition.get("sp_work_gubun").equals("0006")) {	//
				sql.append("\r\n").append("					  AND 	IA.IN_OUT_DETAIL =		'"+hmCondition.get("sp_work_gubun")+"' 					 				");
			}
			
		} else if (hmCondition.get("sp_work_type").equals("SWX")) {
			sql.append("\r\n").append("					  AND (	IA.IN_OUT_DETAIL !=	'0006'	 																");
			sql.append("\r\n").append("					  AND 	OA.IN_OUT_DETAIL NOT	IN	(	'1005' ,	'1008' 	) 		)											");
		}
		/**특근조회 E   N   D**/
		
		//추가 휴가반영 검색조건
		if (hmCondition.get("addVacation").equals("AVO")) {
			if (hmCondition.get("addVacation_gubun").equals(CodeMetrix.ALL)) {
				sql.append("\r\n").append("						AND     OA.ADVANTAGE             IN   ( '3302' , '3303' )		--반일 + 일일휴가																			");
			} else {
				sql.append("\r\n").append("						AND     OA.ADVANTAGE             =   '"+hmCondition.get("addVacation_gubun")+"'						");
			}
		} else	if (hmCondition.get("addVacation").equals("AVX")) {
			sql.append("\r\n").append("						AND    ( OA.ADVANTAGE             =    '3301' OR LEN(OA.ADVANTAGE) = 0 OR OA.ADVANTAGE = '' )		--반일 + 일일휴가											");
		}			
		
		//사번이 ALL인 경우에 쿼리에서 제외한다.
		if (!hmCondition.get("semp_no").equals(CodeMetrix.ALL) &&  hmCondition.get("searchEmpNm").equals("")) {
			sql.append("\r\n").append("					  --AND     XX.EMP_NO                    =   '"+hmCondition.get("semp_no")+"'                    																				");
		} else
			
			//사원검색일 경우 추가됨
			if ( (hmCondition.get("semp_no").equals(CodeMetrix.ALL) || hmCondition.get("semp_no").equals("")) &&  !hmCondition.get("searchEmpNm").equals("")) {
				sql.append("\r\n").append("					  --AND     XX.EMP_NM                    LIKE    '"+hmCondition.get("searchEmpNm")+"%'                   																		");
			}
		
		//확인여부가 ALL인경우 쿼리에서 제외시킴
		if (!hmCondition.get("confirm_yn").equals(CodeMetrix.ALL)) {
			sql.append("\r\n").append("					  AND     XX.CONFIRM_YN                =   '"+hmCondition.get("confirm_yn")+"' --확인여부																						");
		}
		
		//관리자 변경 여부가 ALL이 아닌경우 쿼리에서 제외시킴
		if (!hmCondition.get("mgr_change_yn").equals(CodeMetrix.ALL)) {
			sql.append("\r\n").append("					  AND     XX.MGR_CHANGE_YN             =   '" + hmCondition.get("mgr_change_yn") + "'  --CASE ? WHEN 'ALL' THEN '%' ELSE THEN ? END											");
		}
		
		sql.append("\r\n").append("					  AND   XX.IN_OUT_TP LIKE  	REPLACE('" + hmCondition.get("in_out_tp_condi") + "' , 'ALL' , '%')			--출퇴근분류 																");
		
		//결근
		if (hmCondition.get("absence_type").equals(CodeMetrix.NN) ) {
//	    	sql.append("\r\n").append("				AND	  XX.IN_OUT_DETAIL = '"+hmCondition.get("absence_type")+"'   --결근																											");
			sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL LIKE	REPLACE('"+hmCondition.get("absence_type")+"' , 'ALL' , '%')	--출퇴근유형상세 																");
		}
		
		/**휴가조회 START**/
		if(hmCondition.get("vacation_yn").equals("VCO")) {     //휴가여부가 휴가이면,,
						
			if (hmCondition.get("vacation_type").equals(CodeMetrix.ALL)) {  //모든 휴가
				sql.append("\r\n").append("	 AND 	XX.IN_OUT_DETAIL IN ( '0004' , '0005' , '0007' , '0008' , '0009' , '1006' , '1007' , '1009' , '1010' , '1011' , '2001' , '2002' , '2003' , '2004' , '2005'  ) 	");
				
			}else if (hmCondition.get("vacation_type").equals("VSO")) {		//연차관련
				
				if (hmCondition.get("vacation_gubun").equals(CodeMetrix.ALL)) { //모든 연차관련휴가(연차 + 특별)
					sql.append("\r\n").append("					  AND XX.IN_OUT_DETAIL  IN ( '0004' , '1006' , '2001' , '0007' , '1009' , '2002'  )	");
					
				} else if (hmCondition.get("vacation_gubun").equals("2001")) {	//연차						
					if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 연차휴가						
						sql.append("\r\n").append("			 AND 	XX.IN_OUT_DETAIL IN ( '0004' , '1006' , '2001' ) 	 ");
					}else if(hmCondition.get("vacation_detail").equals("HDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
						sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0004' AND OA.IN_OUT_DETAIL = '1006') OR (IA.IN_OUT_DETAIL = '2001' AND OA.IN_OUT_DETAIL = '2001')  ");
					}else if(hmCondition.get("vacation_detail").equals("HHD")) {   //반일휴가 
						if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
							sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0004' AND OA.IN_OUT_DETAIL != '1006' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0004' AND OA.IN_OUT_DETAIL = '1006' AND XX.IN_OUT_TP = 'O'))	");
						}else if(hmCondition.get("h_vacation_type").equals("0004")) {
							sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0004'	AND OA.IN_OUT_DETAIL != '1006' AND XX.IN_OUT_TP = 'I' ");					
						}else if(hmCondition.get("h_vacation_type").equals("1006")) {
							sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0004'	AND OA.IN_OUT_DETAIL = '1006' AND XX.IN_OUT_TP = 'O' ");								
						}
					}
					//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");

				} else if (hmCondition.get("vacation_gubun").equals("2002")) {	//특별
					if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 특별휴가						
						sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0007' , '1009' , '2002' ) 	 				");
					}else if(hmCondition.get("vacation_detail").equals("SDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
						sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0007' AND OA.IN_OUT_DETAIL = '1009') OR (IA.IN_OUT_DETAIL = '2002' AND OA.IN_OUT_DETAIL = '2002')  ");
					}else if(hmCondition.get("vacation_detail").equals("SHD")) {   //반일휴가 
						if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
							sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0007' AND OA.IN_OUT_DETAIL != '1009' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0007' AND OA.IN_OUT_DETAIL = '1009' AND XX.IN_OUT_TP = 'O'))	");
						}else if(hmCondition.get("h_vacation_type").equals("0004")) {
							sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0007'	AND OA.IN_OUT_DETAIL != '1009' AND XX.IN_OUT_TP = 'I' ");				
						}else if(hmCondition.get("h_vacation_type").equals("1006")) {
							sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0007'	AND OA.IN_OUT_DETAIL = '1009' AND XX.IN_OUT_TP = 'O' ");								
						}
					}
					//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
					
				} //else if (hmCondition.get("vacation_gubun").equals("HFV")) {	//반일연차
					//if (hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
					//	sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN		( '0004' , '1006' ) 	--// 													");
						
					//} else if (hmCondition.get("h_vacation_type").equals("0004")) {
					//	sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL =		'"+hmCondition.get("h_vacation_type")+"'  	--// 				");
					//} else if (hmCondition.get("h_vacation_type").equals("1006")) {
					//	sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL =		 '"+hmCondition.get("h_vacation_type")+"'  	--// 				");
					//}
					
				//}
			}else if (hmCondition.get("vacation_type").equals("VSX")) {		//연차외
				
				//if (hmCondition.get("vacation_gubun").equals("HFO")) {	//반일공가
					
				//	if (hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
				//		sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN		( '0005' , '1007' ) 	--// 									");
				//	} else {
				//		sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL =		'"+hmCondition.get("h_vacation_type")+"'  	--// 				");
				//	}
				//} 
				//else 
				if (hmCondition.get("vacation_gubun").equals(CodeMetrix.ALL)) {	// 모든 연차외 휴가(경조+공가+기타)
					sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0005' , '1007' , '2004' , '0008' , '1010' , '2003' , '0009' , '1011' , '2005'  )   			");
					//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
				} else if (hmCondition.get("vacation_gubun").equals("2003")) {	//경조
					if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 경조휴가						
						sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0008' , '1010' , '2003' ) 	 				");
					}else if(hmCondition.get("vacation_detail").equals("FDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
						sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0008' AND OA.IN_OUT_DETAIL = '1010') OR (IA.IN_OUT_DETAIL = '2003' AND OA.IN_OUT_DETAIL = '2003')  ");
					}else if(hmCondition.get("vacation_detail").equals("FHD")) {   //반일휴가 
						if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
							sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0008' AND OA.IN_OUT_DETAIL != '1010' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0008' AND OA.IN_OUT_DETAIL = '1010' AND XX.IN_OUT_TP = 'O'))	");
						}else if(hmCondition.get("h_vacation_type").equals("0004")) {
							sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0008'	AND OA.IN_OUT_DETAIL != '1010' AND XX.IN_OUT_TP = 'I' ");				
						}else if(hmCondition.get("h_vacation_type").equals("1006")) {
							sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0008'	AND OA.IN_OUT_DETAIL = '1010' AND XX.IN_OUT_TP = 'O' ");						
						}
					}
					
				
					//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
				} else if (hmCondition.get("vacation_gubun").equals("2004")) {	//공가
					if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 공가					
						sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0005' , '1007' , '2004' ) 	 				");
					}else if(hmCondition.get("vacation_detail").equals("GDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
						sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0005' AND OA.IN_OUT_DETAIL = '1007') OR (IA.IN_OUT_DETAIL = '2004' AND OA.IN_OUT_DETAIL = '2004')  ");
					}else if(hmCondition.get("vacation_detail").equals("GHD")) {   //반일휴가 
						if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
							sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0005' AND OA.IN_OUT_DETAIL != '1007' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0005' AND OA.IN_OUT_DETAIL = '1007' AND XX.IN_OUT_TP = 'O'))	");
						}else if(hmCondition.get("h_vacation_type").equals("0004")) {
							sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0005'	AND OA.IN_OUT_DETAIL != '1007' AND XX.IN_OUT_TP = 'I' ");				
						}else if(hmCondition.get("h_vacation_type").equals("1006")) {
							sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0005'	AND OA.IN_OUT_DETAIL = '1007' AND XX.IN_OUT_TP = 'O' ");	
						}							
					}
				
					//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
				} else if (hmCondition.get("vacation_gubun").equals("2005")) {	//기타
					if(hmCondition.get("vacation_detail").equals(CodeMetrix.ALL)) { //모든 기타휴가						
						sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN ( '0009' , '1011' , '2005' ) 	 				");
					}else if(hmCondition.get("vacation_detail").equals("EDD")) {   //일일휴가  -->  이거 어떻게 하지,,,???
						sql.append("\r\n").append("			 AND (IA.IN_OUT_DETAIL = '0009' AND OA.IN_OUT_DETAIL = '1011') OR (IA.IN_OUT_DETAIL = '2005' AND OA.IN_OUT_DETAIL = '2005')  ");
					}else if(hmCondition.get("vacation_detail").equals("EHD")) {   //반일휴가 
						if(hmCondition.get("h_vacation_type").equals(CodeMetrix.ALL)) {
							sql.append("\r\n").append("			 AND 	( (IA.IN_OUT_DETAIL = '0009' AND OA.IN_OUT_DETAIL != '1011' AND XX.IN_OUT_TP = 'I') OR (IA.IN_OUT_DETAIL != '0009' AND OA.IN_OUT_DETAIL = '1011' AND XX.IN_OUT_TP = 'O'))	");
						}else if(hmCondition.get("h_vacation_type").equals("0004")) {
							sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL = '0009'	AND OA.IN_OUT_DETAIL != '1011' AND XX.IN_OUT_TP = 'I' ");					
						}else if(hmCondition.get("h_vacation_type").equals("1006")) {
							sql.append("\r\n").append("			 AND 	 IA.IN_OUT_DETAIL != '0009'	AND OA.IN_OUT_DETAIL = '1011' AND XX.IN_OUT_TP = 'O' ");
						}							
					}
				}
					
					//sql.append("\r\n").append("					  AND 	XX.IN_OUT_TP =		 'O'  	--// 				");
			} else {
					//sql.append("\r\n").append("					  AND 	XX.IN_OUT_DETAIL IN		('0005' , '1007' , '2003' , '2004' , '2005'  )	--// 				");
					sql.append("\r\n").append("					  AND (XX.IN_OUT_DETAIL  IN ( '0005' , '1007' ) OR XX.IN_OUT_DETAIL IN ( '2003' , '2004' , '2005'  ) AND XX.IN_OUT_TP = 'O')		");
				}
				
		}

		if(hmCondition.get("vacation_yn").equals("VCX")) {     //휴가여부가 미휴가이면,,
			sql.append("\r\n").append("		AND 	XX.IN_OUT_DETAIL IN		( '0001' , '0002' , '0003'  , '0006' , '1001' , '1002' , '1003' , '1004' , '1005' , '1008' )   ");
		}
		
		/**휴가조회 END**/			//휴가유형		sql.append("\r\n").append("					  /*조회조건 END*/																																						");
		sql.append("\r\n").append("					  																																										");
		sql.append("\r\n").append("			) Z																																												");
		sql.append("\r\n").append("			WHERE 1=1	  AND	ROWNUM BETWEEN " + start_row + " AND " + end_row 			);
		
		
		System.out.println("======================================88888\r\n");
		System.out.println("--근태관리-관리자-근태확인88888 LIST\r\n" + sql.toString());
		System.out.println("======================================88888\r\n");
		
		logger.info("------------------------------근태관리-관리자-근태확인99999 LIST START---------------------------------");
		logger.info(sql);
		logger.info("------------------------------근태관리-관리자-근태확인99999 LIST END---------------------------------");
		
		pstmt 	= con.prepareStatement(sql.toString());
		
		/**************************************************************************/
		//P A R A M E T E R		V A L U E S		S T A R T
		/**************************************************************************/
		/**************************************************************************/
		//P A R A M E T E R		V A L U E S		E   N   D
		/**************************************************************************/
		
		rs		= pstmt.executeQuery();
		
		System.out.println("근태조회<<<<<<<<<<<<<<<<<<<22222222222");			
		System.out.println(sql.toString());
		System.out.println("근태조회>>>>>>>>>>>>>>>>>>>22222222");
		
		while (rs.next()) {
			
			HashMap<String , String>  hash_map = new HashMap<String, String>();
			
			hash_map.put("대소문자로 구분하여 사용할 것." , "디비에서는 상관없음.");
			
			//jsp에서 <s:property value='upper_dept_no'/> 와 같아야 함.
			hash_map.put("rownum" 				, rs.getString("ROWNUM") );				//ROWNUM
			hash_map.put("group_nm" 			, rs.getString("GROUP_NM") );			//그룹
			hash_map.put("group_nm_tt" 			, rs.getString("GROUP_NM_TT") );			//그룹
			hash_map.put("team_nm"				, rs.getString("TEAM_NM") );			//팀
			hash_map.put("aemp_no"				, rs.getString("EMP_NO") );				//사번	//aemp_no
			hash_map.put("emp_nm"				, rs.getString("EMP_NM") );				//성명
			hash_map.put("yyyymmdd"				, rs.getString("YYYYMMDD") );			//기준일
			hash_map.put("dayname"				, rs.getString("DAYNAME") );			//요일
			hash_map.put("in_out_tp"			, rs.getString("IN_OUT_TP") );			//출근일짜
			hash_map.put("in_out_tp_nm"			, rs.getString("IN_OUT_TP_NM") );			//출근일짜
			hash_map.put("in_out_dt"			, rs.getString("IN_OUT_DT") );			//출근일짜
			hash_map.put("in_out_time"			, rs.getString("IN_OUT_TIME") );		//출근시간
			hash_map.put("reg_ip"				, rs.getString("REG_IP") );				//입력된 IP
			hash_map.put("in_detail"			, rs.getString("IN_DETAIL") );		//퇴근ROW의 출근태상세 code	//2009-03-31
			hash_map.put("in_out_detail"		, rs.getString("IN_OUT_DETAIL") );		//근태상세 code
			hash_map.put("in_out_detail_nm"		, rs.getString("IN_OUT_DETAIL_NM") );	//근태상세
			hash_map.put("in_out_place_nm"		, rs.getString("IN_OUT_PLACE_NM") );	//
			hash_map.put("etc_emp"				, rs.getString("ETC_EMP") );			//입력자 비고
			hash_map.put("etc_emp_memo"			, rs.getString("ETC_EMP_MEMO") );			//입력자 비고
			hash_map.put("update_dt"			, rs.getString("UPDATE_DT") );			//확인시간
			hash_map.put("etc_mgr"				, rs.getString("ETC_MGR") );			//확인자 비고
			hash_map.put("approv_emp_no"		, rs.getString("APPROV_EMP_NO") );		//확인자 사번
			hash_map.put("approv_emp_nm"		, rs.getString("APPROV_EMP_NM") );		//확인자 성명
			hash_map.put("approv_emp_nm_tt"		, rs.getString("APPROV_EMP_NM_TT") );		//확인자 성명
			hash_map.put("mgr_change_yn"		, rs.getString("MGR_CHANGE_YN") );		//확인자 유형상세 변경여부
			hash_map.put("close_dt"				, rs.getString("CLOSE_DT") );		//확인자 유형상세 변경여부
			hash_map.put("advantage"			, rs.getString("ADVANTAGE") );		//
			hash_map.put("advantage_nm"			, rs.getString("ADVANTAGE_NM") );		//휴가
			
			list.add(hash_map);	// 한행의 데이터인 맵객체를 담는다.
			
		}
		
		if (hmCondition.get("confirm_yn").equals(CodeMetrix.NO) && list.size() == 0) {
			p_count	=	CodeMetrix.ZERO;
		} else {
			p_count =	list.size();
		}
		
	} catch (SQLException se) {
		se.printStackTrace();
		BaseException dex = new BaseException();                
		dex.setException(se);
		dex.setAppReturnCode("10");
		throw dex;
	} catch(Exception e) {
		BaseException dex = new BaseException();                
		dex.setException(e);
		dex.setAppReturnCode("20");
		throw dex;
	} finally {
		try {
			if (pstmt != null) pstmt.close();
			if (rs != null) rs.close();
			if(con != null) con.close();
			
		} catch(SQLException fse) {
			BaseException dex = new BaseException();                
			dex.setException(fse);
			dex.setAppReturnCode("10");
			throw dex;
		}
	}
}

	
	
	/**
	 * <pre>
	 * 근태관리확인-관리자-
	 * 관리자가 변경할 데이터를 선택하고 
	 * 확인 버튼을 클릭하였을 시에 실행된다. 
	 * </pre>
	 * @param	listCondition	-	선택한 ROW의 데이터
	 * @throws BaseException
	 * @since	2009/02/09
	 * @author Yang D
	 * @throws SQLException 
	 */
	public void updateAttendManagerConfirm(List<HashMap<String, String>> listCondition) throws BaseException, SQLException {
		
		
		try {
			con		=	getDataSource().getConnection();
			
			/**************************************************************************/
			//T	R	A	N	S	A	C	T	I	O	N				S T A R T
			/**************************************************************************/
			con.setAutoCommit(false);				//default value ture
			
			int row = 0;
			int comp = 0;
			
			String addVaca = "";
			String tmp_advantage = "";
			String tmp_in_out_detail = "";
			
			//System.out.println(listCondition.size() + "           $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$");
			
			for (int i = 0; i < listCondition.size(); i++) {
				
				HashMap<String, String>	hm = listCondition.get(i);
				
				sql.setLength(0);
				
				sql.append("							SELECT	CASE WHEN IN_OUT_DETAIL = '" + hm.get("in_out_detail") + "' THEN 1 ELSE 0 END RETURN_VALUE	\n");
				sql.append("							FROM	TB_ATTEND               																	\n");
				sql.append("							WHERE   YYYYMMDD	= '" 	+ hm.get("yyyymmdd") 		+ "'										\n");
				sql.append("							   AND	EMP_NO		= " 	+ hm.get("emp_no") 			+ "     									\n");
				sql.append("							   AND	IN_OUT_TP	= '" 	+ hm.get("in_out_tp") 	+ "'       										\n");
				
				/*************************************************************************/
				//D	E	B	U	G										S	T	A	R	T
				/*************************************************************************/
//				System.out.println("-------------------------------------------");
//				System.out.println(sql.toString());
//				System.out.println("-------------------------------------------");
				/*************************************************************************/
				//D	E	B	U	G										E		N		D
				/*************************************************************************/

				
				pstmt	=	con.prepareStatement(sql.toString());
				
				rs		=	pstmt.executeQuery();
				
				if (rs.next()) {
					comp = rs.getInt(1);
				}
				
				/* 특별휴가 반영 로직 Start
				 * 2009.11.16 특별휴가 반영 로직을 바꾸다.
				 * TB_VACATION을 사용하지
				 * 미입력 => 미입력 or 반일 or 전일 은 Insert
				 * 반일 or 전일  => 미입력 Delete
				 * 반일 => 전일 or 전일 => 반일 Update
				 * */
				
				// 가지고 있는 값이 미입력인지 확인한다.
				// IN_OUT_DETAIL 값이 '1005'=철야, '1008'=공휴일퇴근 일때 값을 가져온다.
				sql.setLength(0);
				sql.append("\n").append(" SELECT ISNULL(ADVANTAGE,'') AS ADVANTAGE, IN_OUT_DETAIL ");
				sql.append("\n").append(" FROM TB_ATTEND ");
				sql.append("\n").append(" WHERE YYYYMMDD = '"+hm.get("yyyymmdd")+"' AND EMP_NO = '"+hm.get("emp_no")+"' ");
				sql.append("\n").append(" AND IN_OUT_DETAIL IN  ( '1005' , '1008' ) ");
				
				//System.out.println("가지고 있는 값이 미입력인지 확인한다. : "+sql.toString());
				
				pstmt	=	con.prepareStatement(sql.toString());
				
				rs = pstmt.executeQuery();
				
				if(rs.next()){
					//tmp_advantage 현재 가지고 있는 ADVANTAGE 값을 담는다.
					tmp_advantage = rs.getString(1);
					tmp_in_out_detail = rs.getString(2);
				}
				
				System.out.println("tmp_advantage : "+tmp_advantage);
				System.out.println("advantage : "+hm.get("advantage"));
				
				if(tmp_in_out_detail.equals("1005")){
					tmp_in_out_detail = "[철야특별배정] ";
				}else if(tmp_in_out_detail.equals("1008")){
					tmp_in_out_detail = "[공휴일퇴근특별배정] ";
				}
				
				//미입력 => 반일 or 전일 은 Insert
				if((tmp_advantage.equals("") || tmp_advantage.equals("3301")) && !(hm.get("advantage").equals("") || hm.get("advantage").equals("3301"))){
					//tmp_advantage가 공백이면 Insert 시켜야 한다.
					sql.setLength(0);
					
					sql.append("\n").append(" INSERT INTO TB_VACATION(WORK_YEAR, EMP_NO, VACATION_TP, ALLOC_NUM, ALLOC_DT, REMARK, REG_DATE, ALLOC_ID, JOB_TYPE) ");
					sql.append("\n").append(" SELECT ");
					sql.append("\n").append(" CASE WHEN DATEDIFF(d,CONVERT(VARCHAR(8),'"+hm.get("yyyymmdd")+"',112),LEFT('"+hm.get("yyyymmdd")+"',4)+RIGHT(APPLY_DT,4)) > 0 ");
					sql.append("\n").append(" THEN CONVERT(VARCHAR(4),DATEADD(yy,-1,'"+hm.get("yyyymmdd")+"'),121) ");
					sql.append("\n").append(" ELSE CONVERT(VARCHAR(4),'"+hm.get("yyyymmdd")+"',121) END AS WORK_YEAR, ");
					sql.append("\n").append(" EMP_NO, '2002' AS VACATION_TP, ");
					sql.append("\n").append(" CASE WHEN '"+hm.get("advantage")+"' = '3302' THEN '0.5' ");
					sql.append("\n").append("      WHEN '"+hm.get("advantage")+"' = '3303' THEN '1.0' ");
					sql.append("\n").append("      ELSE '0.0' ");
					sql.append("\n").append(" END ALLOC_NUM, ");
					sql.append("\n").append(" '"+hm.get("yyyymmdd")+"' AS ALLOC_DT, ");
					sql.append("\n").append(" '"+tmp_in_out_detail+hm.get("mgr_etc")+"' AS REMARK, ");
					sql.append("\n").append(" GETDATE() AS REG_DATE, ");
					sql.append("\n").append(" '"+hm.get("approv_emp_no")+"' AS ALLOC_ID, ");
					sql.append("\n").append(" 'ADMIN' AS JOB_TYPE ");
					sql.append("\n").append(" FROM TB_EMP ");
					sql.append("\n").append(" WHERE EMP_NO='"+hm.get("emp_no")+"' ");
					
					pstmt	=	con.prepareStatement(sql.toString());

					/************** PARAMETERS START ****************************/
					
					/************** PARAMETERS E N D ****************************/
					row = pstmt.executeUpdate();
					
				//반일 or 전일  => 미입력 Delete
				}else if((tmp_advantage.equals("3302") || tmp_advantage.equals("3303")) && (hm.get("advantage").equals("") || hm.get("advantage").equals("3301"))){
					//tmp_advantage가 공백이면 Delete 시켜야 한다.
					sql.setLength(0);
					sql.append("\n").append(" DELETE TB_VACATION ");
					sql.append("\n").append(" WHERE VACATION_TP='2002' ");
					sql.append("\n").append(" AND ALLOC_DT='"+hm.get("yyyymmdd")+"' ");
					sql.append("\n").append(" AND EMP_NO='"+hm.get("emp_no")+"' ");
					
					pstmt	=	con.prepareStatement(sql.toString());

					/************** PARAMETERS START ****************************/
					//System.out.println("반일 or 전일  => 미입력 Delete : "+sql.toString());
					/************** PARAMETERS E N D ****************************/
					row = pstmt.executeUpdate();
					
				//반일 => 전일 or 전일 => 반일 Update
				}else if((tmp_advantage.equals("3302") && hm.get("advantage").equals("3303")) || (tmp_advantage.equals("3303") && hm.get("advantage").equals("3302"))){
					//반일 => 전일 or 전일 => 반일 Update
					sql.setLength(0);
					sql.append("\n").append(" UPDATE TB_VACATION ");
					sql.append("\n").append(" SET	ALLOC_NUM = ( ");
					sql.append("\n").append(" 	SELECT ");
					sql.append("\n").append(" 	CASE WHEN ADVANTAGE = '3302' AND '"+hm.get("advantage")+"' = '3303' THEN '1.0' ");
					sql.append("\n").append(" 		 WHEN ADVANTAGE = '3303' AND '"+hm.get("advantage")+"' = '3302' THEN '0.5' ");
					sql.append("\n").append(" 	END ");
					sql.append("\n").append(" 	FROM TB_ATTEND ");
					sql.append("\n").append(" 	WHERE YYYYMMDD = '"+hm.get("yyyymmdd")+"' AND EMP_NO = '"+hm.get("emp_no")+"' ");
					sql.append("\n").append(" 	AND IN_OUT_DETAIL IN  ( '1005' , '1008' ) ");
					sql.append("\n").append(" 	), ");
					sql.append("\n").append(" 	REMARK = '"+hm.get("mgr_etc")+"', REG_DATE = GETDATE(), ALLOC_ID = '"+hm.get("approv_emp_no")+"' ");
					sql.append("\n").append(" WHERE VACATION_TP='2002' ");
					sql.append("\n").append(" AND ALLOC_DT='"+hm.get("yyyymmdd")+"' ");
					sql.append("\n").append(" AND EMP_NO='"+hm.get("emp_no")+"' ");
					
					pstmt	=	con.prepareStatement(sql.toString());

					/************** PARAMETERS START ****************************/
					//반일 => 전일 or 전일 => 반일 Update
					/************** PARAMETERS E N D ****************************/
					row = pstmt.executeUpdate();
				
				//반일 => 반일 or 전일 => 전일 Update
				}else if((tmp_advantage.equals("3302") && hm.get("advantage").equals("3302")) && (tmp_advantage.equals("3303") && hm.get("advantage").equals("3303"))){
					
					sql.setLength(0);
					sql.append("\n").append(" UPDATE TB_VACATION ");
					sql.append("\n").append(" SET REMARK = '"+hm.get("mgr_etc")+"', REG_DATE = GETDATE(), ALLOC_ID = '"+hm.get("approv_emp_no")+"' ");
					sql.append("\n").append(" WHERE VACATION_TP='2002' ");
					sql.append("\n").append(" AND ALLOC_DT='"+hm.get("yyyymmdd")+"' ");
					sql.append("\n").append(" AND EMP_NO='"+hm.get("emp_no")+"' ");
					
					pstmt	=	con.prepareStatement(sql.toString());

					/************** PARAMETERS START ****************************/
					//반일 => 반일 or 전일 => 전일 Update
					/************** PARAMETERS E N D ****************************/
					row = pstmt.executeUpdate();
				}
				
				
				/*
				sql.setLength(0);
				
				sql.append("\n").append("              UPDATE TB_VACATION                                                                               ");
				sql.append("\n").append("                 SET ALLOC_NUM    = ALLOC_NUM + CAST (B.ALLOC_NUM_REV AS FLOAT)                                ");
				sql.append("\n").append("                FROM TB_VACATION A,                                                                            ");
				sql.append("\n").append("                     (SELECT EMP_NO,                                                                           ");
				sql.append("\n").append("                             CASE                                                                              ");
				sql.append("\n").append("                                WHEN '"+hm.get("advantage")+"' = '3301' AND ADVANTAGE = '3302' THEN -0.5                       ");
				sql.append("\n").append("                                WHEN '"+hm.get("advantage")+"' = '3301' AND ADVANTAGE = '3303' THEN -1.0                         ");
				sql.append("\n").append("                                WHEN '"+hm.get("advantage")+"' = '3302' AND LEN(ADVANTAGE) = 0 THEN 0.5                         ");
				sql.append("\n").append("                                WHEN '"+hm.get("advantage")+"' = '3302' AND ADVANTAGE = '3301' THEN 0.5                        ");
				sql.append("\n").append("                                WHEN '"+hm.get("advantage")+"' = '3302' AND ADVANTAGE = '3303' THEN -0.5                       ");
				sql.append("\n").append("                                WHEN '"+hm.get("advantage")+"' = '3303' AND LEN(ADVANTAGE) = 0 THEN 1.0                           ");
				sql.append("\n").append("                                WHEN '"+hm.get("advantage")+"' = '3303' AND ADVANTAGE = '3301' THEN 1.0                          ");
				sql.append("\n").append("                                WHEN '"+hm.get("advantage")+"' = '3303' AND ADVANTAGE = '3302' THEN 0.5                        ");
				sql.append("\n").append("                                ELSE 0                                                                         ");
				sql.append("\n").append("                             END                                                                               ");
				sql.append("\n").append("                                ALLOC_NUM_REV                                                                  ");
				sql.append("\n").append("                        FROM TB_ATTEND                                                                         ");
				sql.append("\n").append("                       WHERE     YYYYMMDD = '"+hm.get("yyyymmdd")+"'                                                         ");
				sql.append("\n").append("                             AND EMP_NO = "+hm.get("emp_no")+"                                                                ");
				sql.append("\n").append("                             AND IN_OUT_DETAIL IN  ( '1005' , '1008' )	) B                                                     ");
				sql.append("\n").append("               WHERE A.EMP_NO = B.EMP_NO AND A.CLOSE_YN = 'N' AND A.VACATION_TP = '2002' AND B.ALLOC_NUM_REV <> '0'                       ");
				
				pstmt	=	con.prepareStatement(sql.toString());
				*/
				/************** PARAMETERS START ****************************/
				
				/************** PARAMETERS E N D ****************************/
				//row = pstmt.executeUpdate();
				
				/*
				sql.setLength(0);
				
				sql.append("\n").append("               INSERT INTO TB_VACATION_HIS							      ");
				sql.append("\n").append("                     (										      ");
				sql.append("\n").append("                         WORK_YEAR, EMP_NO, VACATION_TP, ALLOC_NUM, ALLOC_DT			      ");
				sql.append("\n").append("                     )										      ");
				sql.append("\n").append("                  SELECT WORK_YEAR,								      ");
				sql.append("\n").append("                         A.EMP_NO,								      ");
				sql.append("\n").append("                         VACATION_TP,								      ");
				sql.append("\n").append("                         ALLOC_NUM_REV,							      ");
				sql.append("\n").append("                         CONVERT (CHAR (8), GETDATE (), 112)					      ");
				sql.append("\n").append("                    FROM TB_VACATION A,							      ");
				sql.append("\n").append("                         (SELECT EMP_NO,							      ");
				sql.append("\n").append("                                 CASE								      ");
				sql.append("\n").append("                                    WHEN '"+hm.get("advantage")+"' = '3301' AND ADVANTAGE = '3302' THEN -0.5	      ");
				sql.append("\n").append("                                    WHEN '"+hm.get("advantage")+"' = '3301' AND ADVANTAGE = '3303' THEN -1.0	      ");
				sql.append("\n").append("                                    WHEN '"+hm.get("advantage")+"' = '3302' AND (LEN(ADVANTAGE) = 0 OR LEN(ADVANTAGE) IS NULL) THEN 0.5	      ");
				sql.append("\n").append("                                    WHEN '"+hm.get("advantage")+"' = '3302' AND ADVANTAGE = '3301' THEN 0.5	      ");
				sql.append("\n").append("                                    WHEN '"+hm.get("advantage")+"' = '3302' AND ADVANTAGE = '3303' THEN -1.0	      ");
				sql.append("\n").append("                                    WHEN '"+hm.get("advantage")+"' = '3303' AND LEN(ADVANTAGE) = 0 THEN 1.0	      ");
				sql.append("\n").append("                                    WHEN '"+hm.get("advantage")+"' = '3303' AND ADVANTAGE = '3301' THEN 1.0	      ");
				sql.append("\n").append("                                    WHEN '"+hm.get("advantage")+"' = '3303' AND ADVANTAGE = '3302' THEN -0.5	      ");
				sql.append("\n").append("                                    ELSE 0							      ");
				sql.append("\n").append("                                 END								      ");
				sql.append("\n").append("                                    ALLOC_NUM_REV						      ");
				sql.append("\n").append("                            FROM TB_ATTEND							      ");
				sql.append("\n").append("                       WHERE     YYYYMMDD = '"+hm.get("yyyymmdd")+"'                                                         ");
				sql.append("\n").append("                             AND EMP_NO = "+hm.get("emp_no")+"                                                                ");
				sql.append("\n").append("                             AND IN_OUT_DETAIL IN  ( '1005' , '1008' )) B                                                     ");
				sql.append("\n").append("                   WHERE A.EMP_NO = B.EMP_NO AND A.CLOSE_YN = 'N' AND A.VACATION_TP = '2002' AND B.ALLOC_NUM_REV <> '0'	      ");
				
				pstmt	=	con.prepareStatement(sql.toString());
				*/
				/************** PARAMETERS START ****************************/
				
				/************** PARAMETERS E N D ****************************/
				//row = pstmt.executeUpdate();

				/*
				sql.setLength(0);

				sql.append("\n").append("               INSERT INTO TB_VACATION_HIS							      ");
				sql.append("\n").append("                     (										      ");
				sql.append("\n").append("                         WORK_YEAR, EMP_NO, VACATION_TP, ALLOC_NUM, ALLOC_DT			      ");
				sql.append("\n").append("                     )										      ");
				sql.append("\n").append("                  SELECT WORK_YEAR,								      ");
				sql.append("\n").append("                         A.EMP_NO,								      ");
				sql.append("\n").append("                         VACATION_TP,								      ");
				sql.append("\n").append("                         ALLOC_NUM_REV,							      ");
				sql.append("\n").append("                         CONVERT (CHAR (8), GETDATE (), 112)					      ");
				sql.append("\n").append("                    FROM TB_VACATION A,							      ");
				sql.append("\n").append("                         (SELECT EMP_NO,							      ");
				sql.append("\n").append("                                 CASE								      ");
				sql.append("\n").append("                                    WHEN '"+hm.get("advantage")+"' = '3302' AND ADVANTAGE = '3303' THEN 0.5	      				");
				sql.append("\n").append("                                    WHEN '"+hm.get("advantage")+"' = '3303' AND ADVANTAGE = '3302' THEN 1.0	      					");
				sql.append("\n").append("                                 END								      															");
				sql.append("\n").append("                                    ALLOC_NUM_REV						      														");
				sql.append("\n").append("                            FROM TB_ATTEND							      															");
				sql.append("\n").append("                       WHERE     YYYYMMDD = '"+hm.get("yyyymmdd")+"'                                                         		");
				sql.append("\n").append("                             AND EMP_NO = "+hm.get("emp_no")+"                                                                		");
				sql.append("\n").append("                             AND IN_OUT_DETAIL IN  ( '1005' , '1008' )                                                    ");
				sql.append("\n").append("               				  AND ADVANTAGE in ( '3302', '3303' )		      ");
				sql.append("\n").append("               				  ) B						      ");
				sql.append("\n").append("                   WHERE A.EMP_NO = B.EMP_NO AND A.CLOSE_YN = 'N' AND A.VACATION_TP = '2002'	AND B.ALLOC_NUM_REV <> '0'      ");
				
				
				pstmt	=	con.prepareStatement(sql.toString());
				*/				
				/************** PARAMETERS START ****************************/
				
				/************** PARAMETERS E N D ****************************/
				//row = pstmt.executeUpdate();
				
				/*
				//휴가반영부분 history..
				//반일휴가
				if (hm.get("advantage").equals("3302") ) {
					
					sql.setLength(0);
					
					sql.append("\n").append("                              UPDATE TB_VACATION													");
					sql.append("\n").append("                              SET ALLOC_NUM    = ALLOC_NUM + cast (B.ALLOC_NUM_REV AS float)		");
					sql.append("\n").append("                                FROM TB_VACATION A,												");
					sql.append("\n").append("                                     (SELECT EMP_NO, '0.5'	ALLOC_NUM_REV							");
					sql.append("\n").append("                                        FROM TB_ATTEND												");
					sql.append("\n").append("                                       WHERE     YYYYMMDD = '"+hm.get("yyyymmdd")+"'				");
					sql.append("\n").append("                                             AND EMP_NO = "+hm.get("emp_no")+"						");
					sql.append("\n").append("                                             AND IN_OUT_DETAIL = '"+hm.get("in_out_detail")+"'		");
					sql.append("\n").append("                                             AND (LEN(ADVANTAGE) = 0 OR ADVANTAGE IN ('3301') )		");
					sql.append("\n").append("                              ) B																	");
					sql.append("\n").append("                               WHERE A.EMP_NO = B.EMP_NO AND A.CLOSE_YN = 'N' AND A.VACATION_TP = '2002'	");

					pstmt	=	con.prepareStatement(sql.toString());
					
					pstmt.executeUpdate();
					
					
					//
					sql.setLength(0);
					
					sql.append("\n").append("              	INSERT INTO TB_VACATION_HIS                                                                     ");
					sql.append("\n").append("              	     (                                                                                      ");
					sql.append("\n").append("              	         WORK_YEAR, EMP_NO, VACATION_TP, ALLOC_NUM, ALLOC_DT                        		");
					sql.append("\n").append("              	     )                                                                                      ");
					sql.append("\n").append("              	  SELECT WORK_YEAR,                                                                         ");
					sql.append("\n").append("              	         A.EMP_NO,                                                                          ");
					sql.append("\n").append("              	         VACATION_TP,                                                                       ");
					sql.append("\n").append("              	         ALLOC_NUM_REV,                                                                     ");
					sql.append("\n").append("              	         CONVERT (CHAR (8), GETDATE (), 112)                                                ");
					sql.append("\n").append("              	    FROM TB_VACATION A,                                                                     ");
					sql.append("\n").append("                           (SELECT EMP_NO, '0.5'	ALLOC_NUM_REV							");
					sql.append("\n").append("              	            FROM TB_ATTEND                                                                  ");
					sql.append("\n").append("              	           WHERE     YYYYMMDD = '"+hm.get("yyyymmdd")+"'                                    ");
					sql.append("\n").append("              	                 AND EMP_NO = '"+hm.get("emp_no")+"'                                        ");
					sql.append("\n").append("              	                 AND IN_OUT_DETAIL = '"+hm.get("in_out_detail")+"'                          ");
					sql.append("\n").append("              	                         AND (LEN(ADVANTAGE) = 0 OR ADVANTAGE IN ('3301') )                  ");
					sql.append("\n").append("              	 ) B                                                                                          ");
					sql.append("\n").append("              	   WHERE A.EMP_NO = B.EMP_NO AND A.CLOSE_YN = 'N' AND A.VACATION_TP = '2002' 				");
					
					pstmt	=	con.prepareStatement(sql.toString());
					
					pstmt.executeUpdate();

				} 
				
				//일일휴가
				if ( hm.get("advantage").equals("3303") ) {
					
					sql.setLength(0);
					
					sql.append("\n").append("                              UPDATE TB_VACATION													");
					sql.append("\n").append("                              SET ALLOC_NUM    = ALLOC_NUM + cast (B.ALLOC_NUM_REV AS float)		");
					sql.append("\n").append("                                FROM TB_VACATION A,												");
					sql.append("\n").append("                                     (SELECT EMP_NO, CASE											");
					sql.append("\n").append("                                                        WHEN '"+hm.get("advantage")+"' = '3302' THEN 0.5	--		");
					sql.append("\n").append("                                                        WHEN '"+hm.get("advantage")+"' = '3303' THEN 1	--			");
					sql.append("\n").append("                                                     END											");
					sql.append("\n").append("                                                        ALLOC_NUM_REV								");
					sql.append("\n").append("                                        FROM TB_ATTEND												");
					sql.append("\n").append("                                       WHERE     YYYYMMDD = '"+hm.get("yyyymmdd")+"'				");
					sql.append("\n").append("                                             AND EMP_NO = "+hm.get("emp_no")+"						");
					sql.append("\n").append("                                             AND IN_OUT_DETAIL = '"+hm.get("in_out_detail")+"'		");
					sql.append("\n").append("                                             AND (LEN(ADVANTAGE) = 0 OR ADVANTAGE IN ('3301') )		");
					sql.append("\n").append("                              ) B																	");
					sql.append("\n").append("                               WHERE A.EMP_NO = B.EMP_NO AND A.CLOSE_YN = 'N' AND A.VACATION_TP = '2002'	");

					pstmt	=	con.prepareStatement(sql.toString());
					
					pstmt.executeUpdate();
					
					
					//
					sql.setLength(0);
					
					sql.append("\n").append("              	INSERT INTO TB_VACATION_HIS                                                                     ");
					sql.append("\n").append("              	     (                                                                                      ");
					sql.append("\n").append("              	         WORK_YEAR, EMP_NO, VACATION_TP, ALLOC_NUM, ALLOC_DT                        		");
					sql.append("\n").append("              	     )                                                                                      ");
					sql.append("\n").append("              	  SELECT WORK_YEAR,                                                                         ");
					sql.append("\n").append("              	         A.EMP_NO,                                                                          ");
					sql.append("\n").append("              	         VACATION_TP,                                                                       ");
					sql.append("\n").append("              	         ALLOC_NUM_REV,                                                                     ");
					sql.append("\n").append("              	         CONVERT (CHAR (8), GETDATE (), 112)                                                ");
					sql.append("\n").append("              	    FROM TB_VACATION A,                                                                     ");
					sql.append("\n").append("              	         (SELECT EMP_NO, CASE                                                               ");
					sql.append("\n").append("              	                            WHEN '"+hm.get("advantage")+"' = '3302' THEN 0.5                                ");
					sql.append("\n").append("              	                            WHEN '"+hm.get("advantage")+"' = '3303' THEN 1                                  ");
					sql.append("\n").append("              	                         END                                                                ");
					sql.append("\n").append("              	                            ALLOC_NUM_REV                                                   ");
					sql.append("\n").append("              	            FROM TB_ATTEND                                                                  ");
					sql.append("\n").append("              	           WHERE     YYYYMMDD = '"+hm.get("yyyymmdd")+"'                                    ");
					sql.append("\n").append("              	                 AND EMP_NO = '"+hm.get("emp_no")+"'                                        ");
					sql.append("\n").append("              	                 AND IN_OUT_DETAIL = '"+hm.get("in_out_detail")+"'                          ");
					sql.append("\n").append("              	                         AND (LEN(ADVANTAGE) = 0 OR ADVANTAGE IN ('3301') )                  ");
					sql.append("\n").append("              	 ) B                                                                                          ");
					sql.append("\n").append("              	   WHERE A.EMP_NO = B.EMP_NO AND A.CLOSE_YN = 'N' AND A.VACATION_TP = '2002' 				");
					
					pstmt	=	con.prepareStatement(sql.toString());
					
					pstmt.executeUpdate();
				}
				
				//미반영
				if ( hm.get("advantage").equals("3301") ) {
					
					sql.setLength(0);
					
					
					sql.append("\n").append("              	UPDATE TB_VACATION                                                              ");
					sql.append("\n").append("              	   SET ALLOC_NUM    = ALLOC_NUM + cast (B.ALLOC_NUM_REV AS float)               ");
					sql.append("\n").append("              	  FROM TB_VACATION A,                                                           ");
					sql.append("\n").append("              	       (SELECT EMP_NO, CASE                                                     ");
					sql.append("\n").append("              	                          WHEN ADVANTAGE = '3302' THEN -0.5       ");
					sql.append("\n").append("              	                          WHEN ADVANTAGE = '3303' THEN -1         ");
					sql.append("\n").append("              	                       END                                                      ");
					sql.append("\n").append("              	                          ALLOC_NUM_REV                                         ");
					sql.append("\n").append("              	          FROM TB_ATTEND                                                        ");
					sql.append("\n").append("              	           WHERE     YYYYMMDD = '"+hm.get("yyyymmdd")+"'                        ");
					sql.append("\n").append("              	                 AND EMP_NO = '"+hm.get("emp_no")+"'                            ");
					sql.append("\n").append("              	                 AND IN_OUT_DETAIL = '"+hm.get("in_out_detail")+"'              ");
					sql.append("\n").append("              	               AND ADVANTAGE IN ('3302', '3303')) B                             ");
					sql.append("\n").append("              	 WHERE A.EMP_NO = B.EMP_NO AND A.CLOSE_YN = 'N' AND A.VACATION_TP = '2002'		");					
					
					pstmt	=	con.prepareStatement(sql.toString());
					
					pstmt.executeUpdate();
					
					sql.setLength(0);
					
					
					sql.append("\n").append("              	INSERT INTO tb_vacation_his                                                         ");
					sql.append("\n").append("              	      (                                                                             ");
					sql.append("\n").append("              	          work_year, emp_no, vacation_tp, ALLOC_NUM, alloc_dt                       ");
					sql.append("\n").append("              	      )                                                                             ");
					sql.append("\n").append("              	   SELECT work_year,                                                                ");
					sql.append("\n").append("              	          a.emp_no,                                                                 ");
					sql.append("\n").append("              	          vacation_tp,                                                              ");
					sql.append("\n").append("              	          ALLOC_NUM_REV,                                                            ");
					sql.append("\n").append("              	          convert (CHAR (8), GETDATE (), 112)                                       ");
					sql.append("\n").append("              	     FROM tb_vacation a,                                                            ");
					sql.append("\n").append("              	          (SELECT EMP_NO, CASE                                                      ");
					sql.append("\n").append("              	                             WHEN ADVANTAGE = '3302' THEN -0.5                      ");
					sql.append("\n").append("              	                             WHEN ADVANTAGE = '3303' THEN -1                        ");
					sql.append("\n").append("              	                          END                                                       ");
					sql.append("\n").append("              	                             ALLOC_NUM_REV                                          ");
					sql.append("\n").append("              	             FROM TB_ATTEND                                                         ");
					sql.append("\n").append("              	           WHERE     YYYYMMDD = '"+hm.get("yyyymmdd")+"'                                ");
					sql.append("\n").append("              	                 AND EMP_NO = '"+hm.get("emp_no")+"'                                    ");
					sql.append("\n").append("              	                 AND IN_OUT_DETAIL = '"+hm.get("in_out_detail")+"'                      ");
					sql.append("\n").append("              	                  AND ADVANTAGE IN ('3302', '3303')) b                              ");
					sql.append("\n").append("              	    WHERE a.emp_no = b.emp_no AND A.CLOSE_YN = 'N' AND A.VACATION_TP = '2002'  		");
					
					pstmt	=	con.prepareStatement(sql.toString());
					
					pstmt.executeUpdate();
				}
				*/
				
				/* 특별휴가 반영로직 End */
				/**************************************************************************************************/

				
				/* 근태확인 반영로직 Start */
				sql.setLength(0);
				
				sql.append("              UPDATE                                                                     			\n");
				sql.append("                              TB_ATTEND                                                  			\n");
				sql.append("              SET                                                                        			\n");
				sql.append("                              IN_OUT_DETAIL           =       '" + hm.get("in_out_detail") + "'                  \n");
	            sql.append("                      ,       ETC_EMP                 =       '" + hm.get("etc_emp")+ "'                         \n");
				sql.append("                      ,       ETC_MGR                 =       '" + hm.get("mgr_etc") + "'                        \n");
				sql.append("                      ,       APPROV_EMP_NO           =       " + Integer.valueOf(hm.get("approv_emp_no")) + "   \n");
				
				//0이 아니면 변경된 것으로 간주함.
				if (comp != 1) {
					sql.append("                      ,       MGR_CHANGE_YN           =       'Y'                        \n");
				}
				
				sql.append("                      ,       CONFIRM_YN              =       'Y'                        \n");
				sql.append("                      ,       UPDATE_DT               =       GETDATE()                  \n");
				sql.append("                      ,       ADVANTAGE               =       '" + hm.get("advantage") + "'                  \n");
				sql.append("              WHERE                                                                      \n");
				sql.append("                              EMP_NO                      =       " + Integer.valueOf(hm.get("emp_no")) + "      \n");
				
				//휴가유형일 경우 출근/퇴근 에 모두 동일하게 적용되게 해야한다.
				if ( !hasDailyType( hm.get("in_out_detail") ) ) {
					sql.append("                      AND     IN_OUT_TP                   =       '" + hm.get("in_out_tp") + "'              \n");
				}
				
				sql.append("                      AND     YYYYMMDD                    =       '" + hm.get("yyyymmdd") + "'                   \n");
				
				System.out.println("-----------------------------------------------------------------------");
				System.out.println("근태확인-확인버튼 클릭시 -업데이트-\n" + sql.toString());
				System.out.println("-----------------------------------------------------------------------");
				
				pstmt	=	con.prepareStatement(sql.toString());
				
				/************** PARAMETERS START ****************************/
				
				/************** PARAMETERS E N D ****************************/
				row = pstmt.executeUpdate();
				
				System.out.println("************"+sql.toString());
				
				/* 근태확인 반영로직 End */
				
			}	//for
			
			if (row < 1) {
				msg = "저장한 데이터가 저장되지 않았습니다.";
			} else {
				msg = "저장한 데이터가 모두 저장 되었습니다.";
				//입력할 데이터가 있는 경우 커밋함.
				con.commit();
			}
		} catch (SQLException se) {
			/**************************************************************************/
			//T	R	A	N	S	A	C	T	I	O	N				R O L  L B A C K
			/**************************************************************************/
			con.rollback();   // rollback하여 작업된 것을 취소한다..
			se.printStackTrace();
			BaseException dex = new BaseException();                
			dex.setException(se);
			dex.setAppReturnCode("10");
			throw dex;
		} catch(Exception e) {
			BaseException dex = new BaseException();
			dex.setException(e);
			dex.setAppReturnCode("20");
			throw dex;
		} finally {
			try {
				if (pstmt != null) pstmt.close();
				if (rs != null) rs.close();
				if (con != null) con.close();

			} catch(SQLException fse) {
				BaseException dex = new BaseException();                
				dex.setException(fse);
				dex.setAppReturnCode("10");
				throw dex;
			}
		}
		
	}
	
	/**
	 * <pre>
	 * key에 해당하는 value가 ALL인지 null인지 판별하여 
	 * boolean Type으로 return한다.
	 * </pre>
	 * @param key
	 * @return
	 */
	public boolean chkAllNull(String key) {
		
		boolean		flag	=	false;
		
		if (!hmCondition.get(key).equals("ALL") || hmCondition.get(key) != null) {
			flag	=	true;
		}
		
		return flag;
		
	}
	
	/**
	 * <pre>--접근할수 있는 그룹의 팀권한을 조회한다.</pre>
	 * @return -List
	 * @throws BaseException
	 * @since 2009/02/17
	 */
	public List retrieveAuthDeptByEmp_no(String emp_no) throws BaseException {
		try {
			con = super.getDataSource().getConnection();

			sql.setLength(0);

			sql.append("			  	--접근할수 있는 그룹의 팀권한을 조회한다.                                    \r\n");
			sql.append("			    	SELECT 		D.DEPT_NO 			TEAM_NO                             \r\n");
			sql.append("			    		, 	D.DEPT_NM 			TEAM_NM                                 \r\n");
			sql.append("			    		, 	D.UPPER_DEPT_NO 		GROUP_NO                            \r\n");
			sql.append("			    		, 	G.DEPT_NM			GROUP_NM                             	\r\n");
			sql.append("			    	FROM	                                                            \r\n");
			sql.append("			    		TB_AUTH_DEPT A JOIN TB_DEPT D                                   \r\n");
			sql.append("			    			ON A.DEPT_NO		=	D.DEPT_NO	                      	\r\n");
			sql.append("			    			AND A.EMP_NO		=	?	--사번                      					\r\n");
			sql.append("			    			AND A.APPROV_YN		=	'Y'                                 \r\n");
			sql.append("			    			JOIN TB_DEPT G                                              \r\n");
			sql.append("			    			ON D.UPPER_DEPT_NO	=	G.DEPT_NO                           \r\n");

//			System.out.println("================================================================\r\n");
//			System.out.println("사원관리 결과조회-조회건수.\r\n" + sql.toString());
//			System.out.println("================================================================\r\n");

			pstmt = con.prepareStatement(sql.toString());

			int idx = 1;
			//----------------------------params
			pstmt.setString(idx++, emp_no); //사번
			//----------------------------

			rs = pstmt.executeQuery();

			list = new ArrayList<HashMap<String,String>>();

			while (rs.next()) {
				HashMap<String, String> hm = new HashMap<String, String>();
				
				hm.put("group_no"	, rs.getString("GROUP_NO"));
				hm.put("group_nm"	, rs.getString("GROUP_NM"));
				hm.put("team_no"	, rs.getString("TEAM_NO"));
				hm.put("team_nm"	, rs.getString("TEAM_NM"));
				hm.put("emp_no"		, rs.getString("EMP_NO"));
				hm.put("emp_nm"		, rs.getString("EMP_NM"));
				hm.put("user_id"	, rs.getString("USER_ID"));
				hm.put("rank_nm"	, rs.getString("RANK_NM"));
				hm.put("position"	, rs.getString("POSITION"));
				hm.put("apply_dt"	, rs.getString("APPLY_DT"));
				hm.put("retire_dt"	, rs.getString("RETIRE_DT"));
				hm.put("work_yn"	, rs.getString("WORK_YN"));
				
				list.add(hm);
			}

		} catch (SQLException se) {
			se.printStackTrace();
			BaseException dex = new BaseException();
			dex.setException(se);
			dex.setAppReturnCode("10");
			throw dex;
		} catch (Exception e) {
			e.printStackTrace();
			BaseException dex = new BaseException();
			dex.setException(e);
			dex.setAppReturnCode("20");
			throw dex;
		} finally {
			this.close(con);
			this.close(pstmt);
			this.close(rs);
		}
		return list;
	}
	
	/**
	 * <pre>휴가유형인지 알아본다.</pre>
	 * @param vc_tp			-휴가유형 -
	 * @return
	 * @throws BaseException
	 * @since	2009/02/18
	 */
	public boolean hasDailyType(String type) throws BaseException {
		boolean		flag = false;
		
		Connection 			conn		=	null;
		PreparedStatement 	pt			=	null;
		ResultSet			rsset		=	null;
		
		try {
			conn = super.getDataSource().getConnection();
			
			StringBuffer query	=	new StringBuffer();

			query.append("			  				SELECT COUNT(*)     CNT        									\n");
			query.append("			  				FROM                        									\n");
			query.append("			  				(                           									\n");
			query.append("			  				    SELECT  CD              									\n");
			query.append("			  				    FROM    TB_COMM_CD      									\n");
			query.append("			  				    WHERE   GROUP_CD = '102'									\n");
			query.append("			  				        AND CD      <> '0'  									\n");
//			query.append("			  				        OR CD IN ('NN' , '8003')     							\n");
			query.append("			  				        OR CD IN ('NN' , '8003')     							\n");
			query.append("			  				) X                         									\n");
			query.append("			  				WHERE X.CD			= '" + type + "'  							\n");

//			System.out.println("================================================================\r\n");
//			System.out.println("휴가유형일 경우 조회.\r\n" + query.toString());
//			System.out.println("================================================================\r\n");

			pt = con.prepareStatement( query.toString() );

			rsset = pt.executeQuery();
			
			int 		cnt = 0;
			
			if (rsset.next()) {
				cnt = rsset.getInt("CNT");
				
				if (cnt > 0) {
					flag = true;
					System.out.println("cnt~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~			>>" + cnt);
					System.out.println("###########					휴가입니다.				~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
				}
			}

		} catch (SQLException se) {
			se.printStackTrace();
			BaseException dex = new BaseException();
			dex.setException(se);
			dex.setAppReturnCode("10");
			throw dex;
		} catch (Exception e) {
			e.printStackTrace();
			BaseException dex = new BaseException();
			dex.setException(e);
			dex.setAppReturnCode("20");
			throw dex;
		} finally {
			this.close(conn);
			this.close(pt);
			this.close(rsset);
		}
		return flag;
	}
	
	
	/**
	 * <pre>평일 출근일경우 select</pre>
	 * @throws BaseException
	 * @author Yang D
	 * @since	2009/03/15
	 */
	public void retrieveDailyIn() throws BaseException {
		
		try {
			con = DBConnection.getDataSource().getConnection();
			
			sql.setLength(0);
			
			sql.append("						--평일 출근유형                                                         										        \n");
			sql.append("						SELECT 	ETC_CD , CD_NM                                                      	\n");
			sql.append("						, SUBSTRING(ETC_CD , 3, LEN(ETC_CD)) AS CD                                      \n");
			sql.append("						FROM 	TB_COMM_CD                                                      		\n");
			sql.append("						WHERE 	GROUP_CD = 'MM'                                                         \n");
			sql.append("                                AND ETC_CD != '331009'                                                  \n");
			sql.append("                                AND ETC_CD != '341010'                                                  \n");
			sql.append("                                AND ETC_CD != '351011'                                                  \n");
			sql.append("						ORDER BY CD				                                                        \n");
			
//			System.out.println("======================================\r\n");
//			System.out.println("출력건수\r\n" + sql.toString());
//			System.out.println("======================================\r\n");
			
			pstmt 	= 	con.prepareStatement(sql.toString());
			
			rs		=	pstmt.executeQuery();
			
			list = new ArrayList<HashMap<String,String>>();

			while (rs.next()) {
				HashMap<String, String> hm = new HashMap<String, String>();
				
				hm.put("etc_cd"		, rs.getString("ETC_CD"));
				hm.put("cd_nm"		, rs.getString("CD_NM")	);
				hm.put("cd"			, rs.getString("CD")	);
				
				list.add(hm);
			}
			
			sql.setLength(0);
			
			sql.append("						--평일 출근유형                                                         										\n");
			sql.append("						SELECT 	ETC_CD , CD_NM                                                      	\n");
			sql.append("						, SUBSTRING(ETC_CD , 3, LEN(ETC_CD)) AS CD                                      \n");
			sql.append("						FROM 	TB_COMM_CD                                                      		\n");
			sql.append("						WHERE 	GROUP_CD = 'LL'                                                         \n");
			
//			System.out.println("======================================\r\n");
//			System.out.println("출력건수\r\n" + sql.toString());
//			System.out.println("======================================\r\n");
			
			pstmt 	= 	con.prepareStatement(sql.toString());
			
			rs		=	pstmt.executeQuery();
			
			list_LL = new ArrayList<HashMap<String,String>>();
			
			while (rs.next()) {
				HashMap<String, String> hm = new HashMap<String, String>();
				
				hm.put("etc_cd"		, rs.getString("ETC_CD"));
				hm.put("cd_nm"		, rs.getString("CD_NM")	);
				hm.put("cd"			, rs.getString("CD")	);
				
				list_LL.add(hm);
			}
			
		} catch (SQLException se) {
			se.printStackTrace();
			BaseException dex = new BaseException();                
			dex.setException(se);
			dex.setAppReturnCode("10");
			throw dex;
		} catch(Exception e) {
			BaseException dex = new BaseException();                
			dex.setException(e);
			dex.setAppReturnCode("20");
			throw dex;
		} finally {
			try {
				if (pstmt != null) pstmt.close();
				if (rs != null) rs.close();
				if(con != null) con.close();

			} catch(SQLException fse) {
				BaseException dex = new BaseException();                
				dex.setException(fse);
				dex.setAppReturnCode("10");
				throw dex;
			}          
		}
	}
	
	/**
	 * <pre>오전공가
	 * 오후공가제외함.
	 * </pre>
	 * @throws BaseException
	 * @author Yang D
	 * @since	2009/03/15
	 */
	public void retrieveDailyInAmPublicMission() throws BaseException {
		
		try {
			con = DBConnection.getDataSource().getConnection();

			sql.setLength(0);
			
			sql.append("						--평일 출근유형                                                         										\n");
			sql.append("						SELECT 	CD , CD_NM                                                      										\n");
			sql.append("						FROM 	TB_COMM_CD                                                      										\n");
			sql.append("						WHERE 	1=1                                                             										\n");
			sql.append("						AND		(                                                               										\n");
			sql.append("									CD IN ('NN' , 'XX')							--미입력 // 결근										\n");
			sql.append("									OR                                                          										\n");
			sql.append("									GROUP_CD 	IN	( 	'100'	,	'102'	)	--출근 // 휴가  										\n");
			sql.append("								)                                                               										\n");
			sql.append("						AND 	USE_YN 		= 	'Y'                                             										\n");
			sql.append("						AND 	CD 			NOT IN ( 	'0' ,'0006'		)		--제외          										\n");
			
			
//			System.out.println("======================================\r\n");
//			System.out.println("출력건수\r\n" + sql.toString());
//			System.out.println("======================================\r\n");
			
			pstmt 	= 	con.prepareStatement(sql.toString());
			
			rs		=	pstmt.executeQuery();
			
			list = new ArrayList<HashMap<String,String>>();
			
			while (rs.next()) {
				HashMap<String, String> hm = new HashMap<String, String>();
				
				hm.put("cd"		, rs.getString("CD"));
				hm.put("cd_nm"	, rs.getString("CD_NM"));
				
				list.add(hm);
			}
			
		} catch (SQLException se) {
			se.printStackTrace();
			BaseException dex = new BaseException();                
			dex.setException(se);
			dex.setAppReturnCode("10");
			throw dex;
		} catch(Exception e) {
			BaseException dex = new BaseException();                
			dex.setException(e);
			dex.setAppReturnCode("20");
			throw dex;
		} finally {
			try {
				if (pstmt != null) pstmt.close();
				if (rs != null) rs.close();
				if(con != null) con.close();
				
			} catch(SQLException fse) {
				BaseException dex = new BaseException();                
				dex.setException(fse);
				dex.setAppReturnCode("10");
				throw dex;
			}          
		}
	}
	
	/**
	 * <pre>오전휴가
	 * 오후휴가제외함.
	 * </pre>
	 * @throws BaseException
	 * @author Yang D
	 * @since	2009/03/15
	 */
	public void retrieveDailyInAmRest() throws BaseException {
		
		try {
			con = DBConnection.getDataSource().getConnection();
			
			sql.setLength(0);
			
			sql.append("				--평일 출근유형(오전휴가)                                         					\n");
			sql.append("				SELECT  CD , CD_NM                                                     					\n");
			sql.append("				FROM    TB_COMM_CD                                                     					\n");
			sql.append("				WHERE   1=1                                                            					\n");
			sql.append("				AND             (                                                      					\n");
			sql.append("				        CD IN ('NN' , 'XX')                        --미입력 // 결근    					\n");
			sql.append("				        OR                                                             					\n");
			sql.append("				        GROUP_CD        IN      (       '100'   )   --출근 // 휴가     					\n");
			sql.append("				)                                                                      					\n");
			sql.append("				AND     USE_YN          =       'Y'                                    					\n");
			sql.append("				AND     CD          NOT IN (        '0' ,'0006' , '0005' )       --제외					\n");
			
			
//			System.out.println("======================================\r\n");
//			System.out.println("출력건수\r\n" + sql.toString());
//			System.out.println("======================================\r\n");
			
			pstmt 	= 	con.prepareStatement(sql.toString());
			
			rs		=	pstmt.executeQuery();
			
			list = new ArrayList<HashMap<String,String>>();
			
			while (rs.next()) {
				HashMap<String, String> hm = new HashMap<String, String>();
				
				hm.put("cd", rs.getString("CD"));
				hm.put("cd_nm", rs.getString("CD_NM"));
				
				list.add(hm);
			}
			
		} catch (SQLException se) {
			se.printStackTrace();
			BaseException dex = new BaseException();                
			dex.setException(se);
			dex.setAppReturnCode("10");
			throw dex;
		} catch(Exception e) {
			BaseException dex = new BaseException();                
			dex.setException(e);
			dex.setAppReturnCode("20");
			throw dex;
		} finally {
			try {
				if (pstmt != null) pstmt.close();
				if (rs != null) rs.close();
				if(con != null) con.close();
				
			} catch(SQLException fse) {
				BaseException dex = new BaseException();                
				dex.setException(fse);
				dex.setAppReturnCode("10");
				throw dex;
			}          
		}
	}
	
	
	/**
	 * <pre>평일 퇴근 select 휴가제외</pre>
	 * @throws BaseException
	 * @author Yang D
	 * @since	2009/03/15 
	 */
	public void retrieveDailyOut() throws BaseException {
		
		try {
			con = DBConnection.getDataSource().getConnection();
			
			sql.setLength(0);
			
			sql.append("						--평일 퇴근유형                                      									\n");
			sql.append("						SELECT                                                			\n");
			sql.append("							   	CD, CD_NM                                     			\n");
			sql.append("						FROM                                                  			\n");
			sql.append("							 	TB_COMM_CD                                    			\n");
			sql.append("						WHERE 	1 = 1                                         			\n");
			sql.append("							  	AND GROUP_CD IN ( '101', '102', '105', '104' )			\n");
			sql.append("								AND USE_YN = 'Y'                              			\n");
			sql.append("						  		AND CD NOT IN ( '0', '1008' )                 			\n");

			
//			System.out.println("======================================\r\n");
//			System.out.println("출력건수\r\n" + sql.toString());
//			System.out.println("======================================\r\n");
			
			pstmt 	= 	con.prepareStatement(sql.toString());
			
			rs		=	pstmt.executeQuery();
			

			list = new ArrayList<HashMap<String,String>>();

			while (rs.next()) {
				HashMap<String, String> hm = new HashMap<String, String>();
				
				hm.put("cd", rs.getString("CD"));
				hm.put("cd_nm", rs.getString("CD_NM"));
				
				list.add(hm);
			}
			
		} catch (SQLException se) {
			se.printStackTrace();
			BaseException dex = new BaseException();                
			dex.setException(se);
			dex.setAppReturnCode("10");
			throw dex;
		} catch(Exception e) {
			BaseException dex = new BaseException();                
			dex.setException(e);
			dex.setAppReturnCode("20");
			throw dex;
		} finally {
			try {
				if (pstmt != null) pstmt.close();
				if (rs != null) rs.close();
				if(con != null) con.close();
				
			} catch(SQLException fse) {
				BaseException dex = new BaseException();                
				dex.setException(fse);
				dex.setAppReturnCode("10");
				throw dex;
			}          
		}
	}
	
	/**
	 * <pre>
	 * 오후공가
	 * 오전공가 제외함. 
	 * </pre>
	 * @throws BaseException
	 */
	public void retrieveDailyOutPmPublicMission() throws BaseException {
		
		try {
			con = DBConnection.getDataSource().getConnection();
			
			sql.setLength(0);
			
			sql.append("				--평일 출근유형(오후공가)                                          		         			\n");
			sql.append("				SELECT  CD , CD_NM                                                                					\n");
			sql.append("				FROM    TB_COMM_CD                                                                					\n");
			sql.append("				WHERE   1=1                                                                       					\n");
			sql.append("				AND     GROUP_CD        IN      (       '101' , '105' ,'104'   )   --출근 // 휴가 					\n");
			sql.append("				AND     USE_YN          =       'Y'                                               					\n");
			sql.append("				AND     CD          NOT IN (        '0' ,'1008' , '1006' )       --제외           					\n");
		
//			System.out.println("======================================\r\n");
//			System.out.println("출력건수\r\n" + sql.toString());
//			System.out.println("======================================\r\n");
			
			pstmt 	= 	con.prepareStatement(sql.toString());
			
			rs		=	pstmt.executeQuery();
			
			
			list = new ArrayList<HashMap<String,String>>();
			
			while (rs.next()) {
				HashMap<String, String> hm = new HashMap<String, String>();
				
				hm.put("cd", rs.getString("CD"));
				hm.put("cd_nm", rs.getString("CD_NM"));
				
				list.add(hm);
			}
			
		} catch (SQLException se) {
			se.printStackTrace();
			BaseException dex = new BaseException();                
			dex.setException(se);
			dex.setAppReturnCode("10");
			throw dex;
		} catch(Exception e) {
			BaseException dex = new BaseException();                
			dex.setException(e);
			dex.setAppReturnCode("20");
			throw dex;
		} finally {
			try {
				if (pstmt != null) pstmt.close();
				if (rs != null) rs.close();
				if(con != null) con.close();
				
			} catch(SQLException fse) {
				BaseException dex = new BaseException();                
				dex.setException(fse);
				dex.setAppReturnCode("10");
				throw dex;
			}          
		}
	}
	
	/**
	 * <pre>
	 * 오후휴가
	 * 오전휴가 제외함. 
	 * </pre>
	 * @throws BaseException
	 */
	public void retrieveDailyOutPmRest() throws BaseException {
		
		try {
			con = DBConnection.getDataSource().getConnection();
			
			sql.setLength(0);
			
			sql.append("				--평일 퇴근유형(오후휴가)                                         		             			\n");
			sql.append("				SELECT  CD , CD_NM                                                     	             		\n");
			sql.append("				FROM    TB_COMM_CD                                                     	             		\n");
			sql.append("				WHERE   1=1                                                            	             		\n");
			sql.append("				AND      GROUP_CD        IN      (       '101' , '104' , '105'  )   --출근 // 휴가   			\n");
			sql.append("				AND     USE_YN          =       'Y'                                    	             		\n");
			sql.append("				AND     CD          NOT IN (        '0' ,'1008' , '1007' )       --제외	             		\n");
			sql.append("				                                                                                     		\n");			
//			System.out.println("======================================\r\n");
//			System.out.println("출력건수\r\n" + sql.toString());
//			System.out.println("======================================\r\n");
			
			pstmt 	= 	con.prepareStatement(sql.toString());
			
			rs		=	pstmt.executeQuery();
			
			
			list = new ArrayList<HashMap<String,String>>();
			
			while (rs.next()) {
				HashMap<String, String> hm = new HashMap<String, String>();
				
				hm.put("cd"		, rs.getString("CD"));
				hm.put("cd_nm"	, rs.getString("CD_NM"));
				
				list.add(hm);
			}
			
		} catch (SQLException se) {
			se.printStackTrace();
			BaseException dex = new BaseException();                
			dex.setException(se);
			dex.setAppReturnCode("10");
			throw dex;
		} catch(Exception e) {
			BaseException dex = new BaseException();                
			dex.setException(e);
			dex.setAppReturnCode("20");
			throw dex;
		} finally {
			try {
				if (pstmt != null) pstmt.close();
				if (rs != null) rs.close();
				if(con != null) con.close();
				
			} catch(SQLException fse) {
				BaseException dex = new BaseException();                
				dex.setException(fse);
				dex.setAppReturnCode("10");
				throw dex;
			}          
		}
	}
	
	/**
	 * <pre> 퇴근유형  select 휴가제외</pre>
	 * @throws BaseException
	 * @author Yang D
	 * @since	2009/03/15 
	 */
	public void retrieveDailyCheckOut() throws BaseException {
		
		try {
			con = DBConnection.getDataSource().getConnection();
			
			sql.setLength(0);
			
			sql.append("						--퇴근유형select  휴가제외                                            										\n");
			sql.append("						SELECT 	CD , CD_NM                                           										\n");
			sql.append("						FROM 	TB_COMM_CD                                           										\n");
			sql.append("						WHERE 	1=1                                                  										\n");
			sql.append("						AND		(                                                    										\n");
			sql.append("									GROUP_CD 	IN	( 	'101'	,'104','105'	)    										\n");
			sql.append("								)                                                										\n");
			sql.append("						AND 	USE_YN 		= 	'Y'                                  										\n");
			sql.append("						AND 	CD 			NOT IN ( 	'0' ,'1008'		)            										\n");
		
//			System.out.println("======================================\r\n");
//			System.out.println(sql.toString());
//			System.out.println("======================================\r\n");
			
			pstmt 	= 	con.prepareStatement(sql.toString());
			
			rs		=	pstmt.executeQuery();
			
			
			list = new ArrayList<HashMap<String,String>>();
			
			while (rs.next()) {
				HashMap<String, String> hm = new HashMap<String, String>();
				
				hm.put("cd", rs.getString("CD"));
				hm.put("cd_nm", rs.getString("CD_NM"));
				
				list.add(hm);
			}
			
		} catch (SQLException se) {
			se.printStackTrace();
			BaseException dex = new BaseException();                
			dex.setException(se);
			dex.setAppReturnCode("10");
			throw dex;
		} catch(Exception e) {
			BaseException dex = new BaseException();                
			dex.setException(e);
			dex.setAppReturnCode("20");
			throw dex;
		} finally {
			try {
				if (pstmt != null) pstmt.close();
				if (rs != null) rs.close();
				if(con != null) con.close();
				
			} catch(SQLException fse) {
				BaseException dex = new BaseException();                
				dex.setException(fse);
				dex.setAppReturnCode("10");
				throw dex;
			}          
		}
	}
	
	/**
	 * <pre>출근 휴형select</pre>
	 * @throws BaseException
	 * @author Yang D
	 * @since	2009/03/16 
	 */
	public void retrieveDailyCheckIn() throws BaseException {
		
		try {
			con = DBConnection.getDataSource().getConnection();
			
			sql.setLength(0);
			
			sql.append("							SELECT  CD , CD_NM                                                      									\n");
			sql.append("							FROM    TB_COMM_CD                                                      									\n");
			sql.append("							WHERE   1=1                                                             									\n");
			sql.append("							AND			GROUP_CD    IN  (   '100'  , '104' ,'105' )   --출근 // 휴가									\n");
			sql.append("							AND     USE_YN      =   'Y'                                             									\n");
			sql.append("							AND     CD          NOT IN (    '0' ,'0006'     )       --제외          									\n");
			
//			System.out.println("======================================\r\n");
//			System.out.println("출근 휴형select\r\n" + sql.toString());
//			System.out.println("======================================\r\n");
			
			pstmt 	= 	con.prepareStatement(sql.toString());
			
			rs		=	pstmt.executeQuery();
			
			
			list = new ArrayList<HashMap<String,String>>();
			
			while (rs.next()) {
				HashMap<String, String> hm = new HashMap<String, String>();
				
				hm.put("cd"		, rs.getString("CD"));
				hm.put("cd_nm"	, rs.getString("CD_NM"));
				
				list.add(hm);
			}
			
		} catch (SQLException se) {
			se.printStackTrace();
			BaseException dex = new BaseException();                
			dex.setException(se);
			dex.setAppReturnCode("10");
			throw dex;
		} catch(Exception e) {
			BaseException dex = new BaseException();                
			dex.setException(e);
			dex.setAppReturnCode("20");
			throw dex;
		} finally {
			try {
				if (pstmt != null) pstmt.close();
				if (rs != null) rs.close();
				if(con != null) con.close();
				
			} catch(SQLException fse) {
				BaseException dex = new BaseException();                
				dex.setException(fse);
				dex.setAppReturnCode("10");
				throw dex;
			}          
		}
	}
	
	/**
	 * <pre>휴일 출근 select</pre>
	 * @throws BaseException
	 * @author Yang D
	 * @since	2009/03/15 
	 */
	public void retrieveHolidayIn() throws BaseException {
		
		try {
			con = DBConnection.getDataSource().getConnection();
			
			sql.setLength(0);
			
			sql.append("						--공휴일 출근                         										\n");
			sql.append("						SELECT	CD , CD_NM                    										\n");
			sql.append("						FROM	TB_COMM_CD                    										\n");
			sql.append("						WHERE	CD IN ('XX' , '0006' , '8003')										\n");
			sql.append("						AND 	LEN(GROUP_CD) > 2													\n");

//			System.out.println("======================================\r\n");
//			System.out.println("출력건수\r\n" + sql.toString());
//			System.out.println("======================================\r\n");
			
			pstmt 	= 	con.prepareStatement(sql.toString());
			
			rs		=	pstmt.executeQuery();
			

			list = new ArrayList<HashMap<String,String>>();

			while (rs.next()) {
				HashMap<String, String> hm = new HashMap<String, String>();
				
				hm.put("cd", rs.getString("CD"));
				hm.put("cd_nm", rs.getString("CD_NM"));
				
				list.add(hm);
			}
			
		} catch (SQLException se) {
			se.printStackTrace();
			BaseException dex = new BaseException();                
			dex.setException(se);
			dex.setAppReturnCode("10");
			throw dex;
		} catch(Exception e) {
			BaseException dex = new BaseException();                
			dex.setException(e);
			dex.setAppReturnCode("20");
			throw dex;
		} finally {
			try {
				if (pstmt != null) pstmt.close();
				if (rs != null) rs.close();
				if(con != null) con.close();
				
			} catch(SQLException fse) {
				BaseException dex = new BaseException();                
				dex.setException(fse);
				dex.setAppReturnCode("10");
				throw dex;
			}          
		}
	}
	
	/**
	 * <pre>휴일 퇴근 select</pre>
	 * @throws BaseException
	 * @author Yang D
	 * @since	2009/03/15 
	 */
	public void retrieveHolidayOut() throws BaseException {
		
		try {
			con = DBConnection.getDataSource().getConnection();
			
			sql.setLength(0);
			
			sql.append("						--공휴일 퇴근                         										\n");
			sql.append("						SELECT	CD , CD_NM                    										\n");
			sql.append("						FROM	TB_COMM_CD                    										\n");
			sql.append("						WHERE	CD IN ('XX' , '1008' , '8003')										\n");
			sql.append("						AND 	LEN(GROUP_CD) > 2													\n");

//			System.out.println("======================================\r\n");
//			System.out.println("출력건수\r\n" + sql.toString());
//			System.out.println("======================================\r\n");
			
			pstmt 	= 	con.prepareStatement(sql.toString());
			
			rs		=	pstmt.executeQuery();
			

			list = new ArrayList<HashMap<String,String>>();

			while (rs.next()) {
				HashMap<String, String> hm = new HashMap<String, String>();
				
				hm.put("cd", rs.getString("CD"));
				hm.put("cd_nm", rs.getString("CD_NM"));
				
				list.add(hm);
			}
			
		} catch (SQLException se) {
			se.printStackTrace();
			BaseException dex = new BaseException();                
			dex.setException(se);
			dex.setAppReturnCode("10");
			throw dex;
		} catch(Exception e) {
			BaseException dex = new BaseException();                
			dex.setException(e);
			dex.setAppReturnCode("20");
			throw dex;
		} finally {
			try {
				if (pstmt != null) pstmt.close();
				if (rs != null) rs.close();
				if(con != null) con.close();
				
			} catch(SQLException fse) {
				BaseException dex = new BaseException();                
				dex.setException(fse);
				dex.setAppReturnCode("10");
				throw dex;
			}          
		}
	}
	
	
	/**
	 * <pre>근태확인화면에서 사원이름을 클릭시 출퇴근상세정보Pop-up을 연다.</pre>
	 * @param yyyymmdd
	 * @param emp_no
	 * @param in_out_type
	 * @since	2009-03-20
	 * @author Yang D
	 */
	public void retrieveDetailInfoByEmpNoYyyymmddInOutTp(String one_yyyymmdd, int emp_no, String in_out_type) throws BaseException {
		
		try {
			con = DBConnection.getDataSource().getConnection();
			
			sql.setLength(0);
			
			sql.append("                           SELECT                                                                                   	 			\n");
			sql.append("                                           E.EMP_NM            , A.YYYYMMDD                                          				\n");
			sql.append("                                           , A.EMP_NO          , A.IN_OUT_DT                                         				\n");
			sql.append("                                           , A.IN_OUT_TP					                                         				\n");
			sql.append("                                           , SUBSTRING(A.IN_OUT_TIME,1,2) + ':' + SUBSTRING(A.IN_OUT_TIME , 3,2)   IN_OUT_TIME		\n");
			sql.append("                                           , A.IN_OUT_DETAIL , C.CD_NM AS IN_OUT_DETAIL_NM    	 									\n");
			sql.append("                                           , A.IN_OUT_PLACE_NM , A.ETC_EMP                                           				\n");
			sql.append("                                           , A.ETC_MGR         , A.REG_IP                                            				\n");
			sql.append("                                           , CONVERT(VARCHAR(16) , A.UPDATE_DT , 120)    UPDATE_DT                   				\n");
			sql.append("                                           , M.EMP_NM AS APPROV_EMP_NM ,        A.APPROV_EMP_NO                    					\n");
			sql.append("                                           , A.MGR_CHANGE_YN   , A.CONFIRM_YN                                        				\n");
			sql.append("                           FROM TB_ATTEND A                                                                          				\n");
			sql.append("                           INNER JOIN TB_EMP E                                                                       				\n");
			sql.append("                           ON A.EMP_NO = E.EMP_NO                                                                    				\n");
			sql.append("                               AND A.YYYYMMDD  = '"+one_yyyymmdd+"'    --?                                           				\n");
			sql.append("                               AND A.EMP_NO    = "+emp_no+"            --?                                           				\n");
			sql.append("                               AND A.IN_OUT_TP = '"+in_out_type+"'     --?                                           				\n");
			sql.append("                           LEFT JOIN TB_EMP M                                                                       \n");
			sql.append("                           ON  A.APPROV_EMP_NO = M.EMP_NO                                                            \n");
			sql.append("                           INNER JOIN   TB_COMM_CD C                                                                 \n");
			sql.append("                            ON A.IN_OUT_DETAIL      = C.CD                                                           \n");
			
//			System.out.println("======================================\r\n");
//			System.out.println("출력건수\r\n" + sql.toString());
//			System.out.println("======================================\r\n");
			
			pstmt 	= 	con.prepareStatement(sql.toString());
			
			rs		=	pstmt.executeQuery();
			

			list = new ArrayList<HashMap<String,String>>();

			while (rs.next()) {

				HashMap<String, String> hm = new HashMap<String, String>();
				
				hm.put("emp_nm"             , rs.getString("EMP_NM")        );
				hm.put("yyyymmdd"           , rs.getString("YYYYMMDD")      );
				hm.put("emp_no"             , rs.getString("EMP_NO")        );
				hm.put("in_out_tp"          , rs.getString("IN_OUT_TP")     );
				hm.put("in_out_dt"          , rs.getString("IN_OUT_DT")     );
				hm.put("in_out_time"        , rs.getString("IN_OUT_TIME")   );
				hm.put("in_out_detail"      , rs.getString("IN_OUT_DETAIL") );
				hm.put("in_out_detail_nm"   , rs.getString("IN_OUT_DETAIL_NM") );
				hm.put("in_out_place_nm"    , rs.getString("IN_OUT_PLACE_NM"));
				hm.put("etc_emp"            , rs.getString("ETC_EMP")       );
				hm.put("etc_mgr"            , rs.getString("ETC_MGR")       );
				hm.put("reg_ip"             , rs.getString("REG_IP")        );
				hm.put("update_dt"          , rs.getString("UPDATE_DT")     );
				hm.put("approv_emp_no"      , rs.getString("APPROV_EMP_NO") );
				hm.put("approv_emp_nm"      , rs.getString("APPROV_EMP_NM") );
				hm.put("mgr_change_yn"      , rs.getString("MGR_CHANGE_YN") );
				hm.put("confirm_yn"         , rs.getString("CONFIRM_YN")    );

				list.add(hm);
			}
			
		} catch (SQLException se) {
			se.printStackTrace();
			BaseException dex = new BaseException();                
			dex.setException(se);
			dex.setAppReturnCode("10");
			throw dex;
		} catch(Exception e) {
			BaseException dex = new BaseException();                
			dex.setException(e);
			dex.setAppReturnCode("20");
			throw dex;
		} finally {
			try {
				if (pstmt != null) pstmt.close();
				if (rs != null) rs.close();
				if(con != null) con.close();
				
			} catch(SQLException fse) {
				BaseException dex = new BaseException();                
				dex.setException(fse);
				dex.setAppReturnCode("10");
				throw dex;
			}          
		}
		
	}
	
	/**
	 * <pre>출근정보에 따른 퇴근List</pre>
	 * @throws BaseException
	 * @author Yang D
	 * @since	2009-03-31
	 */
	public void retrieveOutDetailList() throws BaseException {
		
		try {
			
			con = DBConnection.getDataSource().getConnection();
			
			sql.setLength(0);
			
			sql.append("							--정상출근                                                        								                                     \n");
			sql.append("							SELECT	ETC_CD, CD_NM   , SUBSTRING(ETC_CD, 3 , LEN(ETC_CD)) CD                                  \n");
			sql.append("							FROM	TB_COMM_CD                                                								\n");
			sql.append("							WHERE	GROUP_CD =                                                								\n");
			sql.append("							(                                                                 								\n");
			sql.append("								SELECT	SUBSTRING(ETC_CD, 0, 3)                           									\n");
			sql.append("								FROM	TB_COMM_CD                                        									\n");
			sql.append("								WHERE	GROUP_CD = 'MM'                                   									\n");
			sql.append("								AND		SUBSTRING(ETC_CD, 3, LEN(ETC_CD)) = '0001'											\n");
			sql.append("							)                                                                 								\n");
			
//			System.out.println("======================================\r\n");
//			System.out.println("출근유형에 맞는 퇴근유형 LIST\r\n" + sql.toString());
//			System.out.println("======================================\r\n");
			
			pstmt 	= 	con.prepareStatement(sql.toString());
			
			rs		=	pstmt.executeQuery();
			

			list_0001 = new ArrayList<HashMap<String,String>>();

			while (rs.next()) {

				HashMap<String, String> hm = new HashMap<String, String>();
				
				hm.put("etc_cd"      , rs.getString("ETC_CD") );
				hm.put("cd_nm"      , rs.getString("CD_NM") );
				hm.put("cd"      	, rs.getString("CD") );
				
				list_0001.add(hm);
			}


			sql.setLength(0);

			sql.append("						          --지각                                            								                \n");
			sql.append("							SELECT	ETC_CD, CD_NM   , SUBSTRING(ETC_CD, 3 , LEN(ETC_CD)) CD                                   \n");
			sql.append("							FROM	TB_COMM_CD                                                								\n");
			sql.append("							WHERE	GROUP_CD =                                                								\n");
			sql.append("							(                                                                 								\n");
			sql.append("								SELECT	SUBSTRING(ETC_CD, 0, 3)                           									\n");
			sql.append("								FROM	TB_COMM_CD                                        									\n");
			sql.append("								WHERE	GROUP_CD = 'MM'                                   									\n");
			sql.append("								AND		SUBSTRING(ETC_CD, 3, LEN(ETC_CD)) = '0001'											\n");
			sql.append("							)                                                                 								\n");
			
//			System.out.println("======================================\r\n");
//			System.out.println("출근유형에 맞는 퇴근유형 LIST\r\n" + sql.toString());
//			System.out.println("======================================\r\n");
			
			pstmt 	= 	con.prepareStatement(sql.toString());
			
			rs		=	pstmt.executeQuery();
			

			list_0002 = new ArrayList<HashMap<String,String>>();

			while (rs.next()) {

				HashMap<String, String> hm = new HashMap<String, String>();
				
				hm.put("etc_cd"      , rs.getString("ETC_CD") );
				hm.put("cd_nm"      , rs.getString("CD_NM") );
				hm.put("cd"      	, rs.getString("CD") );

				list_0002.add(hm);
			}

			sql.setLength(0);

			sql.append("							           --현지출근                                            								            \n");
			sql.append("							SELECT	ETC_CD, CD_NM   , SUBSTRING(ETC_CD, 3 , LEN(ETC_CD)) CD                                   \n");
			sql.append("							FROM	TB_COMM_CD                                                								\n");
			sql.append("							WHERE	GROUP_CD =                                                								\n");
			sql.append("							(                                                                 								\n");
			sql.append("								SELECT	SUBSTRING(ETC_CD, 0, 3)                           									\n");
			sql.append("								FROM	TB_COMM_CD                                        									\n");
			sql.append("								WHERE	GROUP_CD = 'MM'                                   									\n");
			sql.append("								AND		SUBSTRING(ETC_CD, 3, LEN(ETC_CD)) = '0001'											\n");
			sql.append("							)                                                                 								\n");
			
//			System.out.println("======================================\r\n");
//			System.out.println("출근유형에 맞는 퇴근유형 LIST\r\n" + sql.toString());
//			System.out.println("======================================\r\n");
			
			pstmt 	= 	con.prepareStatement(sql.toString());
			
			rs		=	pstmt.executeQuery();
			

			list_0003 = new ArrayList<HashMap<String,String>>();

			while (rs.next()) {

				HashMap<String, String> hm = new HashMap<String, String>();
				
				hm.put("etc_cd"      , rs.getString("ETC_CD") );
				hm.put("cd_nm"      , rs.getString("CD_NM") );
				hm.put("cd"      	, rs.getString("CD") );

				list_0003.add(hm);
			}

			sql.setLength(0);

			sql.append("							                 --오전공가                                     								            \n");
			sql.append("							SELECT	ETC_CD, CD_NM   , SUBSTRING(ETC_CD, 3 , LEN(ETC_CD)) CD                                   \n");
			sql.append("							FROM	TB_COMM_CD                                                								\n");
			sql.append("							WHERE	GROUP_CD =                                                								\n");
			sql.append("							(                                                                 								\n");
			sql.append("								SELECT	SUBSTRING(ETC_CD, 0, 3)                           									\n");
			sql.append("								FROM	TB_COMM_CD                                        									\n");
			sql.append("								WHERE	GROUP_CD = 'MM'                                   									\n");
			sql.append("								AND		SUBSTRING(ETC_CD, 3, LEN(ETC_CD)) = '0001'											\n");
			sql.append("							)                                                                 								\n");
			
//			System.out.println("======================================\r\n");
//			System.out.println("출근유형에 맞는 퇴근유형 LIST\r\n" + sql.toString());
//			System.out.println("======================================\r\n");
			
			pstmt 	= 	con.prepareStatement(sql.toString());
			
			rs		=	pstmt.executeQuery();
			

			list_0005 = new ArrayList<HashMap<String,String>>();

			while (rs.next()) {

				HashMap<String, String> hm = new HashMap<String, String>();
				
				hm.put("etc_cd"      , rs.getString("ETC_CD") );
				hm.put("cd_nm"      , rs.getString("CD_NM") );
				hm.put("cd"      	, rs.getString("CD") );

				list_0005.add(hm);
			}

			sql.setLength(0);


			sql.append("							                               --오전휴가                      								            \n");
			sql.append("							SELECT	ETC_CD, CD_NM   , SUBSTRING(ETC_CD, 3 , LEN(ETC_CD)) CD                                   \n");
			sql.append("							FROM	TB_COMM_CD                                                								\n");
			sql.append("							WHERE	GROUP_CD =                                                								\n");
			sql.append("							(                                                                 								\n");
			sql.append("								SELECT	SUBSTRING(ETC_CD, 0, 3)                           									\n");
			sql.append("								FROM	TB_COMM_CD                                        									\n");
			sql.append("								WHERE	GROUP_CD = 'MM'                                   									\n");
			sql.append("								AND		SUBSTRING(ETC_CD, 3, LEN(ETC_CD)) = '0001'											\n");
			sql.append("							)                                                                 								\n");
			
//			System.out.println("======================================\r\n");
//			System.out.println("출근유형에 맞는 퇴근유형 LIST\r\n" + sql.toString());
//			System.out.println("======================================\r\n");
			
			pstmt 	= 	con.prepareStatement(sql.toString());
			
			rs		=	pstmt.executeQuery();
			

			list_0004 = new ArrayList<HashMap<String,String>>();

			while (rs.next()) {

				HashMap<String, String> hm = new HashMap<String, String>();
				
				hm.put("etc_cd"      , rs.getString("ETC_CD") );
				hm.put("cd_nm"      , rs.getString("CD_NM") );
				hm.put("cd"      	, rs.getString("CD") );

				list_0004.add(hm);
			}
			
			sql.setLength(0);


			sql.append("							                               --오전휴가                      								            \n");
			sql.append("							SELECT	ETC_CD, CD_NM   , SUBSTRING(ETC_CD, 3 , LEN(ETC_CD)) CD                                   \n");
			sql.append("							FROM	TB_COMM_CD                                                								\n");
			sql.append("							WHERE	GROUP_CD =                                                								\n");
			sql.append("							(                                                                 								\n");
			sql.append("								SELECT	SUBSTRING(ETC_CD, 0, 3)                           									\n");
			sql.append("								FROM	TB_COMM_CD                                        									\n");
			sql.append("								WHERE	GROUP_CD = 'MM'                                   									\n");
			sql.append("								AND		SUBSTRING(ETC_CD, 3, LEN(ETC_CD)) = '0001'											\n");
			sql.append("							)                                                                 								\n");
			
//			System.out.println("======================================\r\n");
			System.out.println("출근유형에 맞는 퇴근유형 LIST\r\n" + sql.toString());
//			System.out.println("======================================\r\n");
			
			pstmt 	= 	con.prepareStatement(sql.toString());
			
			rs		=	pstmt.executeQuery();
			

			list_0007 = new ArrayList<HashMap<String,String>>();

			while (rs.next()) {

				HashMap<String, String> hm = new HashMap<String, String>();
				
				hm.put("etc_cd"      , rs.getString("ETC_CD") );
				hm.put("cd_nm"      , rs.getString("CD_NM") );
				hm.put("cd"      	, rs.getString("CD") );

				list_0007.add(hm);
			}
			
			sql.setLength(0);


			sql.append("							                               --오전휴가                      								            \n");
			sql.append("							SELECT	ETC_CD, CD_NM   , SUBSTRING(ETC_CD, 3 , LEN(ETC_CD)) CD                                   \n");
			sql.append("							FROM	TB_COMM_CD                                                								\n");
			sql.append("							WHERE	GROUP_CD =                                                								\n");
			sql.append("							(                                                                 								\n");
			sql.append("								SELECT	SUBSTRING(ETC_CD, 0, 3)                           									\n");
			sql.append("								FROM	TB_COMM_CD                                        									\n");
			sql.append("								WHERE	GROUP_CD = 'MM'                                   									\n");
			sql.append("								AND		SUBSTRING(ETC_CD, 3, LEN(ETC_CD)) = '0001'											\n");
			sql.append("							)                                                                 								\n");
			
//			System.out.println("======================================\r\n");
//			System.out.println("출근유형에 맞는 퇴근유형 LIST\r\n" + sql.toString());
//			System.out.println("======================================\r\n");
			
			pstmt 	= 	con.prepareStatement(sql.toString());
			
			rs		=	pstmt.executeQuery();
			

			list_0008 = new ArrayList<HashMap<String,String>>();

			while (rs.next()) {

				HashMap<String, String> hm = new HashMap<String, String>();
				
				hm.put("etc_cd"      , rs.getString("ETC_CD") );
				hm.put("cd_nm"      , rs.getString("CD_NM") );
				hm.put("cd"      	, rs.getString("CD") );

				list_0008.add(hm);
			}
			
			sql.setLength(0);


			sql.append("							                               --오전휴가                      								            \n");
			sql.append("							SELECT	ETC_CD, CD_NM   , SUBSTRING(ETC_CD, 3 , LEN(ETC_CD)) CD                                   \n");
			sql.append("							FROM	TB_COMM_CD                                                								\n");
			sql.append("							WHERE	GROUP_CD =                                                								\n");
			sql.append("							(                                                                 								\n");
			sql.append("								SELECT	SUBSTRING(ETC_CD, 0, 3)                           									\n");
			sql.append("								FROM	TB_COMM_CD                                        									\n");
			sql.append("								WHERE	GROUP_CD = 'MM'                                   									\n");
			sql.append("								AND		SUBSTRING(ETC_CD, 3, LEN(ETC_CD)) = '0001'											\n");
			sql.append("							)                                                                 								\n");
			
//			System.out.println("======================================\r\n");
//			System.out.println("출근유형에 맞는 퇴근유형 LIST\r\n" + sql.toString());
//			System.out.println("======================================\r\n");
			
			pstmt 	= 	con.prepareStatement(sql.toString());
			
			rs		=	pstmt.executeQuery();
			

			list_0009 = new ArrayList<HashMap<String,String>>();

			while (rs.next()) {

				HashMap<String, String> hm = new HashMap<String, String>();
				
				hm.put("etc_cd"      , rs.getString("ETC_CD") );
				hm.put("cd_nm"      , rs.getString("CD_NM") );
				hm.put("cd"      	, rs.getString("CD") );

				list_0009.add(hm);
			}

			sql.setLength(0);

			sql.append("							--미입력                                                        								\n");
			sql.append("							SELECT	ETC_CD, CD_NM   , SUBSTRING(ETC_CD, 3 , LEN(ETC_CD)) CD   								\n");
			sql.append("							FROM	TB_COMM_CD                                              								\n");
			sql.append("							WHERE	GROUP_CD =                                              								\n");
			sql.append("							(                                                               								\n");
			sql.append("								SELECT	SUBSTRING(ETC_CD, 0, 3)                         									\n");
			sql.append("								FROM	TB_COMM_CD                                      									\n");
			sql.append("								WHERE	GROUP_CD = 'MM'                                 									\n");
			sql.append("								AND		SUBSTRING(ETC_CD, 3, LEN(ETC_CD)) = 'XX'											\n");
			sql.append("							)                                                               								\n");
			
//			System.out.println("======================================\r\n");
//			System.out.println("출근유형에 맞는 퇴근유형 LIST\r\n" + sql.toString());
//			System.out.println("======================================\r\n");
			
			pstmt 	= 	con.prepareStatement(sql.toString());
			
			rs		=	pstmt.executeQuery();
			

			list_XX = new ArrayList<HashMap<String,String>>();

			while (rs.next()) {

				HashMap<String, String> hm = new HashMap<String, String>();
				
				hm.put("etc_cd"      , rs.getString("ETC_CD") );
				hm.put("cd_nm"      , rs.getString("CD_NM") );
				hm.put("cd"      	, rs.getString("CD") );

				list_XX.add(hm);
			}


			sql.setLength(0);
			
			sql.append("							--결근                                                          										\n");
			sql.append("							SELECT	ETC_CD, CD_NM   , SUBSTRING(ETC_CD, 3 , LEN(ETC_CD)) CD									\n");
			sql.append("							FROM	TB_COMM_CD                                              								\n");
			sql.append("							WHERE	GROUP_CD =                                              								\n");
			sql.append("							(                                                               								\n");
			sql.append("								SELECT	SUBSTRING(ETC_CD, 0, 3)                         									\n");
			sql.append("								FROM	TB_COMM_CD                                      									\n");
			sql.append("								WHERE	GROUP_CD = 'MM'                                 									\n");
			sql.append("								AND		SUBSTRING(ETC_CD, 3, LEN(ETC_CD)) = 'NN'											\n");
			sql.append("							)                                                               								\n");
			
//			System.out.println("======================================\r\n");
//			System.out.println("출근유형에 맞는 퇴근유형 LIST\r\n" + sql.toString());
//			System.out.println("======================================\r\n");
			
			pstmt 	= 	con.prepareStatement(sql.toString());
			
			rs		=	pstmt.executeQuery();
			

			list_NN = new ArrayList<HashMap<String,String>>();

			while (rs.next()) {

				HashMap<String, String> hm = new HashMap<String, String>();
				
				hm.put("etc_cd"      , rs.getString("ETC_CD") );
				hm.put("cd_nm"      , rs.getString("CD_NM") );
				hm.put("cd"      	, rs.getString("CD") );

				list_NN.add(hm);
			}

			sql.setLength(0);

			sql.append("							--연차휴가                                                        								\n");
			sql.append("							SELECT	ETC_CD, CD_NM   , SUBSTRING(ETC_CD, 3 , LEN(ETC_CD)) CD                                   \n");
			sql.append("							FROM	TB_COMM_CD                                                								\n");
			sql.append("							WHERE	GROUP_CD =                                                								\n");
			sql.append("							(                                                                 								\n");
			sql.append("								SELECT	SUBSTRING(ETC_CD, 0, 3)                           									\n");
			sql.append("								FROM	TB_COMM_CD                                        									\n");
			sql.append("								WHERE	GROUP_CD = 'MM'                                   									\n");
			sql.append("								AND		SUBSTRING(ETC_CD, 3, LEN(ETC_CD)) = '2001'											\n");
			sql.append("							)                                                                 								\n");
			
//			System.out.println("======================================\r\n");
//			System.out.println("출근유형에 맞는 퇴근유형 LIST\r\n" + sql.toString());
//			System.out.println("======================================\r\n");
			
			pstmt 	= 	con.prepareStatement(sql.toString());
			
			rs		=	pstmt.executeQuery();
			

			list_2001 = new ArrayList<HashMap<String,String>>();

			while (rs.next()) {

				HashMap<String, String> hm = new HashMap<String, String>();
				
				hm.put("etc_cd"      , rs.getString("ETC_CD") );
				hm.put("cd_nm"      , rs.getString("CD_NM") );
				hm.put("cd"      	, rs.getString("CD") );

				list_2001.add(hm);
			}


			sql.setLength(0);

			sql.append("							--특별휴가                                                        								\n");
			sql.append("							SELECT	ETC_CD, CD_NM   , SUBSTRING(ETC_CD, 3 , LEN(ETC_CD)) CD                                   \n");
			sql.append("							FROM	TB_COMM_CD                                                								\n");
			sql.append("							WHERE	GROUP_CD =                                                								\n");
			sql.append("							(                                                                 								\n");
			sql.append("								SELECT	SUBSTRING(ETC_CD, 0, 3)                           									\n");
			sql.append("								FROM	TB_COMM_CD                                        									\n");
			sql.append("								WHERE	GROUP_CD = 'MM'                                   									\n");
			sql.append("								AND		SUBSTRING(ETC_CD, 3, LEN(ETC_CD)) = '2002'											\n");
			sql.append("							)                                                                 								\n");
			
//			System.out.println("======================================\r\n");
//			System.out.println("출근유형에 맞는 퇴근유형 LIST\r\n" + sql.toString());
//			System.out.println("======================================\r\n");
			
			pstmt 	= 	con.prepareStatement(sql.toString());
			
			rs		=	pstmt.executeQuery();
			

			list_2002 = new ArrayList<HashMap<String,String>>();

			while (rs.next()) {

				HashMap<String, String> hm = new HashMap<String, String>();
				
				hm.put("etc_cd"      , rs.getString("ETC_CD") );
				hm.put("cd_nm"      , rs.getString("CD_NM") );
				hm.put("cd"      	, rs.getString("CD") );

				list_2002.add(hm);
			}


			sql.setLength(0);

			sql.append("							--경조휴가                                                        								\n");
			sql.append("							SELECT	ETC_CD, CD_NM   , SUBSTRING(ETC_CD, 3 , LEN(ETC_CD)) CD                                   \n");
			sql.append("							FROM	TB_COMM_CD                                                								\n");
			sql.append("							WHERE	GROUP_CD =                                                								\n");
			sql.append("							(                                                                 								\n");
			sql.append("								SELECT	SUBSTRING(ETC_CD, 0, 3)                           									\n");
			sql.append("								FROM	TB_COMM_CD                                        									\n");
			sql.append("								WHERE	GROUP_CD = 'MM'                                   									\n");
			sql.append("								AND		SUBSTRING(ETC_CD, 3, LEN(ETC_CD)) = '2003'											\n");
			sql.append("							)                                                                 								\n");

//			System.out.println("======================================\r\n");
//			System.out.println("출근유형에 맞는 퇴근유형 LIST\r\n" + sql.toString());
//			System.out.println("======================================\r\n");
			
			pstmt 	= 	con.prepareStatement(sql.toString());
			
			rs		=	pstmt.executeQuery();
			

			list_2003 = new ArrayList<HashMap<String,String>>();

			while (rs.next()) {

				HashMap<String, String> hm = new HashMap<String, String>();
				
				hm.put("etc_cd"      , rs.getString("ETC_CD") );
				hm.put("cd_nm"      , rs.getString("CD_NM") );
				hm.put("cd"      	, rs.getString("CD") );

				list_2003.add(hm);
			}

			sql.setLength(0);
			
			sql.append("							--공가                                                            								\n");
			sql.append("							SELECT	ETC_CD, CD_NM   , SUBSTRING(ETC_CD, 3 , LEN(ETC_CD)) CD                                   \n");
			sql.append("							FROM	TB_COMM_CD                                                								\n");
			sql.append("							WHERE	GROUP_CD =                                                								\n");
			sql.append("							(                                                                 								\n");
			sql.append("								SELECT	SUBSTRING(ETC_CD, 0, 3)                           									\n");
			sql.append("								FROM	TB_COMM_CD                                        									\n");
			sql.append("								WHERE	GROUP_CD = 'MM'                                   									\n");
			sql.append("								AND		SUBSTRING(ETC_CD, 3, LEN(ETC_CD)) = '2004'											\n");
			sql.append("							)                                                                 								\n");

//			System.out.println("======================================\r\n");
//			System.out.println("출근유형에 맞는 퇴근유형 LIST\r\n" + sql.toString());
//			System.out.println("======================================\r\n");
			
			pstmt 	= 	con.prepareStatement(sql.toString());
			
			rs		=	pstmt.executeQuery();
			

			list_2004 = new ArrayList<HashMap<String,String>>();

			while (rs.next()) {

				HashMap<String, String> hm = new HashMap<String, String>();
				
				hm.put("etc_cd"      , rs.getString("ETC_CD") );
				hm.put("cd_nm"      , rs.getString("CD_NM") );
				hm.put("cd"      	, rs.getString("CD") );

				list_2004.add(hm);
			}
			
			sql.setLength(0);
			
			sql.append("							--기타                                                            								\n");
			sql.append("							SELECT	ETC_CD, CD_NM   , SUBSTRING(ETC_CD, 3 , LEN(ETC_CD)) CD                                   \n");
			sql.append("							FROM	TB_COMM_CD                                                								\n");
			sql.append("							WHERE	GROUP_CD =                                                								\n");
			sql.append("							(                                                                 								\n");
			sql.append("								SELECT	SUBSTRING(ETC_CD, 0, 3)                           									\n");
			sql.append("								FROM	TB_COMM_CD                                        									\n");
			sql.append("								WHERE	GROUP_CD = 'MM'                                   									\n");
			sql.append("								AND		SUBSTRING(ETC_CD, 3, LEN(ETC_CD)) = '2005'											\n");
			sql.append("							)                                                                 								\n");
			
//			System.out.println("======================================\r\n");
//			System.out.println("출근유형에 맞는 퇴근유형 LIST\r\n" + sql.toString());
//			System.out.println("======================================\r\n");
			
			pstmt 	= 	con.prepareStatement(sql.toString());
			
			rs		=	pstmt.executeQuery();
			
			
			list_2005 = new ArrayList<HashMap<String,String>>();
			
			while (rs.next()) {
				
				HashMap<String, String> hm = new HashMap<String, String>();
				
				hm.put("etc_cd"      , rs.getString("ETC_CD") );
				hm.put("cd_nm"      , rs.getString("CD_NM") );
				hm.put("cd"      	, rs.getString("CD") );
				
				list_2005.add(hm);
			}
			
		} catch (SQLException se) {
			se.printStackTrace();
			BaseException dex = new BaseException();                
			dex.setException(se);
			dex.setAppReturnCode("10");
			throw dex;
		} catch(Exception e) {
			BaseException dex = new BaseException();                
			dex.setException(e);
			dex.setAppReturnCode("20");
			throw dex;
		} finally {
			try {
				if (pstmt != null) pstmt.close();
				if (rs != null) rs.close();
				if(con != null) con.close();
				
			} catch(SQLException fse) {
				BaseException dex = new BaseException();                
				dex.setException(fse);
				dex.setAppReturnCode("10");
				throw dex;
			}          
		}
	}
	
	/**
	 * <pre>
	 * 	마감  Table에서 
	 * 	마감된 기준일자들을 가져온다.
	 * </pre>
	 * @return
	 * @throws BaseException
	 */
	public List<HashMap<String, String>> retrieveFinishedDT() throws BaseException {
		try {
			con = DBConnection.getDataSource().getConnection();

			sql.setLength(0);

			sql.append("                    SELECT DISTINCT AC.CLOSE_DT                                   \n");
			sql.append("                      FROM    TB_ATTEND_CLOSE AC                                  \n");
			sql.append("                           JOIN                                                   \n");
			sql.append("                              TB_ATTEND A                                         \n");
			sql.append("                           ON AC.CLOSE_DT = A.YYYYMMDD                            \n");

//			System.out.println("======================================\r\n");
//			System.out.println(sql.toString());
//			System.out.println("======================================\r\n");

			pstmt = con.prepareStatement(sql.toString());

			rs = pstmt.executeQuery();

			list	=	new ArrayList<HashMap<String,String>>();
			
			while (rs.next()) {
				HashMap<String, String> hm	=	new HashMap<String, String>();
				
				hm.put("close_dt", rs.getString("CLOSE_DT") );
				
				list.add(hm);
			}

		} catch (SQLException se) {
			se.printStackTrace();
			BaseException dex = new BaseException();
			dex.setException(se);
			dex.setAppReturnCode("10");
			throw dex;
		} catch (Exception e) {
			BaseException dex = new BaseException();
			dex.setException(e);
			dex.setAppReturnCode("20");
			throw dex;
		} finally {
			try {
				if (pstmt != null)
					pstmt.close();
				if (rs != null)
					rs.close();
				if (con != null)
					con.close();

			} catch (SQLException fse) {
				BaseException dex = new BaseException();
				dex.setException(fse);
				dex.setAppReturnCode("10");
				throw dex;
			}
		}
		
		return list;
	}

	/**
	 * <pre>
	 * 승인자 정보는 제외한 목록
	 * </pre>
	 * @param sgroup
	 * @return
	 */
	public List<HashMap<String,String>> retrieveEmpNotInSelf(String sgroup , String session_emp_id) throws SQLException , BaseException {
		try {
			
			con = super.getDataSource().getConnection();
			
			sql.setLength(0);
			
			sql.append("		WITH D  AS(                                 					\r\n");
			sql.append("		    SELECT                                  					\r\n");
			sql.append("						D1.DEPT_NO                  					\r\n");
			sql.append("					,	D1.UPPER_DEPT_NO            					\r\n");
			sql.append("					,	E.EMP_NO                    					\r\n");
			sql.append("					,	E.EMP_NM                    					\r\n");
			sql.append("		    FROM                                    					\r\n");
			sql.append("						TB_DEPT D1                  					\r\n");
			sql.append("		        JOIN    TB_EMP E                    					\r\n");
			sql.append("		        ON      D1.DEPT_NO  =   E.FK_DEPT_NO					\r\n");
			//sql.append("		        AND      E.WORK_YN  =   'Y'								\r\n");
			sql.append("		        AND      D1.USE_YN  =   'Y'								\r\n");
			
			sql.append("		    WHERE E.EMP_NO != " +  session_emp_id + "											\r\n");
			
			sql.append("		)                                           					\r\n");
			sql.append("		SELECT D.EMP_NO , D.EMP_NM                  					\r\n");
			sql.append("		FROM D                                      					\r\n");
			sql.append("		WHERE 1	=	1                               					\r\n");
			sql.append("			AND D.DEPT_NO			LIKE	REPLACE( '" + sgroup + "' , 'ALL' , '%')	\r\n");
			sql.append("		UNION                                       					\r\n");
			sql.append("		SELECT D.EMP_NO , D.EMP_NM                  					\r\n");
			sql.append("		FROM D                                      					\r\n");
			sql.append("		WHERE 1	=	1                               					\r\n");
			sql.append("			AND D.UPPER_DEPT_NO		LIKE	REPLACE( '" + sgroup + "' , 'ALL' , '%')	\r\n");
			
			System.out.println("================================================================\r\n");
			System.out.println("부서코드로 그룹에 소속하거나 팀에 소속한 사원들을 조회한다.\r\n" + sql.toString());
			System.out.println("================================================================\r\n");
			
			pstmt = con.prepareStatement(sql.toString());
			
			rs	=	pstmt.executeQuery();
			
			list 	= 	new ArrayList<HashMap<String,String>>();
			
			while (rs.next()) {
				//각 행의 각각컬럼의 데이터를 담는다.
				HashMap<String , String>  hash_map = new HashMap<String, String>();
				
				//hash_map.put("대소문자로 구분하여 사용할 것." , "디비에서는 상관없음.");
				//jsp에서 <s:property value='upper_dept_no'/> 와 같아야 함.
				hash_map.put("emp_no" 			, rs.getString("EMP_NO") );	//사번
				hash_map.put("emp_nm"			, rs.getString("EMP_NM") );	//성명
				
				list.add(hash_map);	// 한행의 데이터인 맵객체를 담는다.
			}
		} catch (SQLException se){
				se.printStackTrace();
				BaseException dex = new BaseException();                
				dex.setException(se);
				dex.setAppReturnCode("10");
				throw dex;
			} catch(Exception e){
				e.printStackTrace();
				BaseException dex = new BaseException();                
				dex.setException(e);
				dex.setAppReturnCode("20");
				throw dex;
		} finally {
			this.close(con);
			this.close(pstmt);
			this.close(rs);
		}
		
		return list;
	}


	/******************************** G E T T E R / S E T T E R		S T  A R T *************************************/

	public List<HashMap<String, String>> getList() {
		return list;
	}


	public void setList(List<HashMap<String, String>> list) {
		this.list = list;
	}

	public HashMap<String, String> getHmCondition() {
		return hmCondition;
	}


	public void setHmCondition(HashMap<String, String> hmCondition) {
		this.hmCondition = hmCondition;
	}


	public Integer getRowCount() {
		return rowCount;
	}

	public void setRowCount(Integer rowCount) {
		this.rowCount = rowCount;
	}


	public String getMsg() {
		return msg;
	}


	public void setMsg(String msg) {
		this.msg = msg;
	}

	/**
	 * @return the list_0001
	 */
	public List<HashMap<String, String>> getList_0001() {
		return list_0001;
	}


	/**
	 * @param list_0001 the list_0001 to set
	 */
	public void setList_0001(List<HashMap<String, String>> list_0001) {
		this.list_0001 = list_0001;
	}


	/**
	 * @return the list_0002
	 */
	public List<HashMap<String, String>> getList_0002() {
		return list_0002;
	}


	/**
	 * @param list_0002 the list_0002 to set
	 */
	public void setList_0002(List<HashMap<String, String>> list_0002) {
		this.list_0002 = list_0002;
	}


	/**
	 * @return the list_0003
	 */
	public List<HashMap<String, String>> getList_0003() {
		return list_0003;
	}


	/**
	 * @param list_0003 the list_0003 to set
	 */
	public void setList_0003(List<HashMap<String, String>> list_0003) {
		this.list_0003 = list_0003;
	}


	/**
	 * @return the list_0004
	 */
	public List<HashMap<String, String>> getList_0004() {
		return list_0004;
	}


	/**
	 * @param list_0004 the list_0004 to set
	 */
	public void setList_0004(List<HashMap<String, String>> list_0004) {
		this.list_0004 = list_0004;
	}


	/**
	 * @return the list_XX
	 */
	public List<HashMap<String, String>> getList_XX() {
		return list_XX;
	}


	/**
	 * @param list_XX the list_XX to set
	 */
	public void setList_XX(List<HashMap<String, String>> list_XX) {
		this.list_XX = list_XX;
	}


	/**
	 * @return the list_NN
	 */
	public List<HashMap<String, String>> getList_NN() {
		return list_NN;
	}


	/**
	 * @param list_NN the list_NN to set
	 */
	public void setList_NN(List<HashMap<String, String>> list_NN) {
		this.list_NN = list_NN;
	}


	/**
	 * @return the list_2001
	 */
	public List<HashMap<String, String>> getList_2001() {
		return list_2001;
	}


	/**
	 * @param list_2001 the list_2001 to set
	 */
	public void setList_2001(List<HashMap<String, String>> list_2001) {
		this.list_2001 = list_2001;
	}


	/**
	 * @return the list_2002
	 */
	public List<HashMap<String, String>> getList_2002() {
		return list_2002;
	}


	/**
	 * @param list_2002 the list_2002 to set
	 */
	public void setList_2002(List<HashMap<String, String>> list_2002) {
		this.list_2002 = list_2002;
	}


	/**
	 * @return the list_2003
	 */
	public List<HashMap<String, String>> getList_2003() {
		return list_2003;
	}


	/**
	 * @param list_2003 the list_2003 to set
	 */
	public void setList_2003(List<HashMap<String, String>> list_2003) {
		this.list_2003 = list_2003;
	}


	/**
	 * @return the list_2004
	 */
	public List<HashMap<String, String>> getList_2004() {
		return list_2004;
	}


	/**
	 * @param list_2004 the list_2004 to set
	 */
	public void setList_2004(List<HashMap<String, String>> list_2004) {
		this.list_2004 = list_2004;
	}
	
	/**
	 * @return the list_0005
	 */
	public List<HashMap<String, String>> getList_0005() {
		return list_0005;
	}


	/**
	 * @param list_0005 the list_0005 to set
	 */
	public void setList_0005(List<HashMap<String, String>> list_0005) {
		this.list_0005 = list_0005;
	}
	
	public List<HashMap<String, String>> getList_0007() {
		return list_0007;
	}


	public void setList_0007(List<HashMap<String, String>> list_0007) {
		this.list_0007 = list_0007;
	}


	public List<HashMap<String, String>> getList_0008() {
		return list_0008;
	}


	public void setList_0008(List<HashMap<String, String>> list_0008) {
		this.list_0008 = list_0008;
	}


	public List<HashMap<String, String>> getList_0009() {
		return list_0009;
	}


	public void setList_0009(List<HashMap<String, String>> list_0009) {
		this.list_0009 = list_0009;
	}


	/**
	 * @return the list_LL
	 */
	public List<HashMap<String, String>> getList_LL() {
		return list_LL;
	}


	/**
	 * @param list_LL the list_LL to set
	 */
	public void setList_LL(List<HashMap<String, String>> list_LL) {
		this.list_LL = list_LL;
	}

	/**
	 * @return the list_2005
	 */
	public List<HashMap<String, String>> getList_2005() {
		return list_2005;
	}

	/**
	 * @param list_2005 the list_2005 to set
	 */
	public void setList_2005(List<HashMap<String, String>> list_2005) {
		this.list_2005 = list_2005;
	}
	
	/**
	 * @return the p_count
	 */
	public Integer getP_count() {
		return p_count;
	}


	/**
	 * @param p_count the p_count to set
	 */
	public void setP_count(Integer p_count) {
		this.p_count = p_count;
	}


	/******************************** G E T T E R / S E T T E R		E	N	D *************************************/
}
